|
| 1 | +--- |
| 2 | +type: decision |
| 3 | +layer: tactical |
| 4 | +kind: plan |
| 5 | +refs: |
| 6 | + - 20260505-153647-d-tac-kv5 |
| 7 | + - 20260505-153654-d-tac-qom |
| 8 | + - 20260413-142536-d-cpt-ah1 |
| 9 | +closes: |
| 10 | + - 20260505-215340-s-cpt-rwd |
| 11 | + - 20260505-215333-s-cpt-jq7 |
| 12 | +participants: |
| 13 | + - Christopher |
| 14 | + - Claude |
| 15 | +confidence: medium |
| 16 | +summary: Plans implementation of `sdd view`, a new CLI command with a composable pipeline of query primitives (source, filter, transform, aggregate, rank, page, render) and named macros to enable lightweight catch-up output at graph scale beyond 400 entries without modifying `sdd status`. The plan references the quick catch-up mode directive (d-tac-kv5) and topic-drill mode decision (d-tac-qom) for operational context, and adopts the CQRS decomposition mandate from the framework contract (d-cpt-ah1). It closes the ranking mechanism signal (s-cpt-rwd) by implementing composite in-degree and heat-decay ranking, and resolves the catch-up synthesis bottleneck (s-cpt-jq7) by replacing synthesis-heavy playbook rewriting with mechanical selection and ranking. |
| 17 | +summary_hash: 91701e07911924ee99781330ed34deb5 |
| 18 | +--- |
| 19 | + |
| 20 | +Plans the implementation of `sdd view` — a new CLI command exposing a composable pipeline of query primitives (source, filter, transform, aggregate, rank, page, render) with named macros as sugar — to enable lightweight, mechanical catch-up output at graph scale beyond 400 entries while leaving `sdd status` unchanged. |
| 21 | + |
| 22 | +**Architecture: pipeline of primitives.** Every layout entry is a chain of function calls (`section:modifier:modifier:...`) where each modifier is itself a function. The grammar is uniform, parsable left-to-right with paren-depth tracking, and extensible without further CLI changes. Filters intersect cumulatively; non-filter modifiers apply last-write-wins per modifier kind. |
| 23 | + |
| 24 | +**Primitives.** Sources: `source(graph)` (default), `source(wip)`. Filters: `active`, `closed`, `superseded`, `kind(K[, ...])`, `layer(L)`, `since(date|duration)`, `topic(L)`. Transforms: `expand(field)`. Aggregates: `group(by:field)` (`count`, `agg(...)` reserved). Rank: `rank(<algorithm>)`. Page: `n(N)` (`offset(O)` reserved). Output: `name(string)`. Render: `as-list`, `as-grouped`, `as-focus-block`, `as-participants-block`, `as-wip-list`. |
| 25 | + |
| 26 | +**Algorithm and decay vocabulary.** Algorithms: `heat(decay)`, `in-degree`, `mult(decay)`, `add(decay)`, `log(decay)`, `by(date)`. Decay names: `exp-{7,14,30}d`, `linear-{7,14,30}d`, `none`. `in-degree` ignores decay silently. `since(Nm)` and `since(Ny)` use Go's `time.AddDate` for calendar-correct subtraction; `Nd` and `Nw` use exact 24h offsets. |
| 27 | + |
| 28 | +**Macros (canonical pipelines, modifier-overridable):** |
| 29 | + |
| 30 | +- `top(N)` → `active:n(N):rank(heat(exp-14d)):as-list` |
| 31 | +- `focus` → `kind(focus):active:expand(involvement):as-focus-block` |
| 32 | +- `topic(L)` → `topic(L):rank(heat(exp-14d)):as-list` |
| 33 | +- `decisions` → `active:kind(plan,directive,activity,contract,aspiration):group(by:kind):as-grouped` |
| 34 | +- `signals` → `active:kind(gap,question):group(by:kind):as-grouped` |
| 35 | +- `insights`, `done`, `aspirations`, `contracts`, `participants`, `wip` — each a named pipeline with appropriate filter+rank+render |
| 36 | + |
| 37 | +**Focus-block state derivation.** For each involvement target in an active focus, resolve actors (per-involvement first, else focus-level default, else empty) and heat (via the configured rank). State: `pull-available` if actors empty; `stalled` if actors present and heat below stalled threshold; otherwise `driving`. Closed/superseded targets are omitted from the focus block. Stalled threshold is configurable via `stalled(value)` modifier; default observed during plan implementation. |
| 38 | + |
| 39 | +**CLI surface.** New command `sdd view` parses `--layout=<spec>`, executes the pipeline, renders. Bare `sdd view` (no `--layout`) prints help — grammar overview, vocabulary reference, and sample invocations — consistent with the no-presets-in-CLI decision (a hidden default would be a preset by another name). For ad-hoc browsing without composition, `sdd list` remains the simpler tool. The existing `sdd status` is **not modified** — its kind-grouped narrative stays as is, deprecation deferred to a future directive once `sdd view` is well-adopted. Pipeline primitives live in shared `internal/` packages so `sdd list` (Plan 1) can consume filter primitives like `topic(L)` without re-implementation. |
| 40 | + |
| 41 | +**Defaults and evaluation methodology.** Initial defaults: `rank=heat`, `decay=exp-14d`, top-N count=25. Stalled threshold default chosen during implementation by qualitative comparison on this graph. Closing done signal carries a findings attachment comparing at least three rank/decay combinations across `top` outputs on the current graph, with usefulness narrative and chosen-default rationale; defaults revisable post-shipping via a separate directive based on observed behavior. |
| 42 | + |
| 43 | +**CQRS decomposition** (per `d-cpt-ah1`): layout parsing in `internal/query/`, pipeline execution and ranking/decay/aggregation in `internal/finders/`, layout/result types in `internal/model/`, render functions in `internal/presenters/`, thin CLI shell in `cmd/sdd/`. |
| 44 | + |
| 45 | +**Out of scope** (deferred): `offset(O)` paging, `count` aggregation, `as-table` and other render shapes, `agg(...)` envelope, `source(topics)` and `as-tree`, `sdd list` rank flags (filter via `topic(L)` is in Plan 1's scope), `sdd status` deprecation, persistent ranking index/cache (v1 is pure read-time). |
| 46 | + |
| 47 | +See [design](./06-151345-d-tac-uww/design.md) for full grammar, vocabulary reference, macro pipelines, render contracts, CQRS package scaffolding, and sample invocations per catch-up move. |
| 48 | + |
| 49 | +## Acceptance criteria |
| 50 | + |
| 51 | +- [ ] New command `sdd view` accepts `--layout=<spec>` per the pipeline grammar |
| 52 | +- [ ] Bare `sdd view` (no `--layout`) prints help — grammar overview, vocabulary reference, and sample invocations — rather than executing any default layout |
| 53 | +- [ ] Empty `--layout=` value produces a grammar error (no implicit fallback) |
| 54 | +- [ ] `sdd status` is not modified by this plan; existing kind-grouped output preserved |
| 55 | +- [ ] Layout grammar implemented (functional, colon-chained, parens for args, nested function calls); parser tracks paren depth |
| 56 | +- [ ] Filters intersect cumulatively; non-filter modifiers apply last-write-wins per modifier kind |
| 57 | +- [ ] Source, filter, transform, aggregate, rank, page, output, and render primitives implemented per the vocabularies in the description |
| 58 | +- [ ] Algorithm vocabulary {heat, in-degree, mult, add, log, by(date)} implemented; in-degree ignores decay silently |
| 59 | +- [ ] Decay vocabulary {exp-{7,14,30}d, linear-{7,14,30}d, none} implemented |
| 60 | +- [ ] `since()` accepts ISO date `YYYY-MM-DD` and duration `Nd|Nw|Nm|Ny`; m/y via `time.AddDate` calendar arithmetic; d/w exact 24h offsets |
| 61 | +- [ ] Macros implemented: top(N), focus, topic(L), decisions, signals, insights, done, aspirations, contracts, participants, wip — each a named pipeline overridable by user modifiers |
| 62 | +- [ ] Focus-block state derivation per the algorithm: pull-available / stalled / driving; closed/superseded targets omitted; stalled threshold configurable via `stalled(value)`; default observed during evaluation |
| 63 | +- [ ] `as-list` deduplicates entries already shown in any focus block in the same layout |
| 64 | +- [ ] `name(string)` modifier sets section header verbatim; otherwise auto-derived from rank+decay |
| 65 | +- [ ] Unknown function/algorithm/decay/render name → clear error listing the valid set |
| 66 | +- [ ] Render-shape mismatch → clear error (e.g., `as-grouped` on flat result) |
| 67 | +- [ ] Invalid layout grammar → clear error pointing to position |
| 68 | +- [ ] CQRS decomposition per `d-cpt-ah1`: layout parsing in `internal/query/`, pipeline execution in `internal/finders/`, types in `internal/model/`, render in `internal/presenters/` |
| 69 | +- [ ] Pipeline primitives in shared internal packages, callable from other CLI commands (`sdd list --topic` consumes `topic(L)` filter) |
| 70 | +- [ ] Unit tests cover layout parser edge cases, ranking algorithms, decay functions, render-shape validation, since() parsing |
| 71 | +- [ ] Smoke test demonstrates `sdd view` against the local graph with light, full, and drill compositions |
| 72 | +- [ ] Skill `cli-reference.md` updated with `sdd view` overview, grammar summary, and section/algorithm/decay reference tables |
| 73 | +- [ ] Closing done signal includes findings attachment: at least three rank/decay combinations compared qualitatively on the current graph, chosen defaults documented with rationale |
0 commit comments