Skip to content

pd-m5: suggest-only triggers for progressive disclosure#153

Merged
josealekhine merged 6 commits into
mainfrom
design/pd-m5-triggers
Jul 26, 2026
Merged

pd-m5: suggest-only triggers for progressive disclosure#153
josealekhine merged 6 commits into
mainfrom
design/pd-m5-triggers

Conversation

@josealekhine

Copy link
Copy Markdown
Member

Summary

Milestone 5 wires progressive disclosure into the session loop. One
knowledge.Health function emits two suggestion-only signals — foldable
roots
(staging has accreted → run /ctx-digest) and heavy pages
(bytes over a ceiling → split the theme or extract it to tooling) — and
feeds all three session surfaces (the check-knowledge growth hook,
/ctx-remember, /ctx-wrap-up) from that single source, so the Go hook
and the prose skills cannot drift. Nothing auto-folds; no state file is
introduced. This resolves the nudge-threshold TBD the pd-m4 plan flagged
as blocking.

The branch also carries one pd-m4 residue commit (session captures) that
rode onto this branch after PR #152 merged.

Changes

  • Config (internal/config/runtime, internal/rc, .ctxrc schema):
    retire the line-count measure convention_line_count for
    convention_section_count (the foldability watermark unit, default 12)
    and add theme_page_byte_ceiling (default 65536). — serves
    specs/progressive-disclosure.md
  • Two-signal core (internal/cli/system/core/knowledge):
    knowledge.Health computes foldability as a staging count via
    disclosure.StagedEntries (so a never-migrated root reads full and a
    folded one quiets) and weight as bytes over the root and every theme
    file
    — closing the blindness the root-only measure had to the bulk
    folding relocates. Both-fire on one root orders foldable first. —
    serves specs/progressive-disclosure.md
  • Per-kind remedies + report path: the nudge routes by signal kind —
    foldable leads with /ctx-digest (consolidate/drift demoted to
    secondary), heavy advises split-or-extract-to-tooling ("a context file
    this heavy is a linter in prose"). A new non-throttled, non-relaying
    ctx system check-knowledge --report path lets the skills read the live
    state on demand. — serves specs/progressive-disclosure.md
  • Surfaces wired: /ctx-remember surfaces foldable/heavy roots in its
    readback (read-only); /ctx-wrap-up surfaces them as a next-session
    suggestion and never folds inline (the human is leaving). Copilot skills
    synced. — serves specs/progressive-disclosure.md
  • Design + plan: specs/progressive-disclosure.md phase 5 formalized;
    decomposed into specs/plans/pd-m5.md (23 tasks, 6 epics, test matrix).

Specs

  • specs/progressive-disclosure.md — the bounded-root model; phase 5
    (suggest-only triggers) is what this milestone implements
  • specs/plans/pd-m5.md — the implementation plan and execution ledger
    this branch executed

Closed tasks

  • [E1] Config: retire ConventionLineCount; add
    ConventionSectionCount + ThemePageByteCeiling + runtime defaults
  • [E2] Health core: finding Kind/Path; foldable signal via
    disclosure.StagedEntries; heavy signal over root + theme-file bytes;
    foldable-first ordering
  • [E3] Wiring: per-kind warning text; format routing; check-knowledge
    report path; hook uses Health
  • [E4] Skills: /ctx-remember + /ctx-wrap-up surface foldable/heavy,
    suggest-only
  • [E5] Tests: health fixtures, heavy root + theme file, both-fire
    ordering, convention measure, boundary/disable, surface parity
  • [E6] Sync + gates: copilot sync, measurement gate, milestone gate

All 23 tasks in specs/plans/pd-m5.md are [x].

Verification

  • Milestone gate (T23): make lint 0 issues, go test ./... green,
    make audit all checks passed.
  • Unit tests (M1–M8): foldable un-migrated, folded-quiet, heavy theme
    file, both-fire ordering, convention-measure-is-sections, boundary
    (>N) and disable (0), and hook↔report surface parity.
  • Measurement gate (T22) driven on a realistic .context (35-entry
    LEARNINGS + 91 KB theme file): both signals surfaced, foldable first,
    with the correct per-kind remedies.

Notes for reviewers

  • The default thresholds (convention_section_count=12,
    theme_page_byte_ceiling=65536) are educated guesses, recorded in the
    plan's Risks as rc-tunable; real-world use may warrant a tweak (an rc
    change, not code).
  • convention_line_count is a breaking rc-key change (line → section
    measure); intentional per the watermark decision, framed as user
    education.

Session knowledge residue from the merged pd-m4 (CONVENTIONS digestion)
work, landed as the first commit of the M5 branch.

Learnings:
- A guard derived from a capability accessor silently lifts when the
  accessor is extended (T04 opening the mover before T13).
- Skill/doc examples of a serialized structure must round-trip through
  the real parser (the latent ctx-digest plan-JSON bug).
- Using the proprietary sibling repo as design evidence leaks its
  internals into tracked files.

Decisions:
- ctx convention add requires --section; no default; placeholders
  rejected (strict).
- Theme declaration via the Themes section keyword, on all three
  canonical kinds.

Task:
- M5: suggest-only trigger wiring for progressive disclosure.

Spec: specs/progressive-disclosure.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Formalizes phase 5 of progressive disclosure (the suggest-only triggers)
into specs/progressive-disclosure.md, resolving the nudge-threshold TBD
the pd-m4 plan flagged as blocking.

One knowledge.Health(ctxDir, thresholds) function feeds all three
surfaces (the check-knowledge hook, /ctx-remember, /ctx-wrap-up), so the
Go hook and the prose skills cannot drift. It emits two signal kinds,
because "should I fold?" and "is this too heavy to be useful context?"
are different questions:

- Foldable root (a COUNT): staged entries via disclosure.StagedEntries
  (## [ blocks / ## sections, excluding ## Themes) over a per-kind
  threshold → suggest /ctx-digest. Reads a never-migrated root correctly.
- Heavy page (a BYTE count): bytes over the root AND every theme file
  under .context/<noun>/ → advisory split-or-extract. The root-only
  measure was blind to the bloat folding relocates into theme files.

The heavy-page remedy is deliberately not tier-2 auto-fold: past a byte
ceiling, an LLM is a poor linter and more Markdown is the wrong fix, so
the human decides whether the content belongs in tooling instead.

convention_line_count (a size measure) is retired for
convention_section_count (the watermark unit); a shared
theme_page_byte_ceiling is added. No state file — staging plus on-disk
bytes are self-describing. The check-knowledge throttle / log-first
plumbing is reused so a declining user is not nagged.

Records both decisions in DECISIONS.md. Implementation follows via
/ctx-task-out --milestone pd-m5.

Spec: specs/progressive-disclosure.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Plan document at specs/plans/pd-m5.md: data model, contracts, an 8-row test matrix, 23 falsifiable tasks in 6 epics, execution waves, and a measurement gate (T22). Epic anchors synced to TASKS.md, partitioning T01-T23 (3+5+4+2+6+3). Blocking TBD (nudge-threshold) resolved in the spec + DECISIONS; default threshold values (section_count=12, byte_ceiling=64KB) carried as deferrable, tunable via rc.

Spec: specs/progressive-disclosure.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
E1 config: retire ConventionLineCount (line measure) for ConventionSectionCount (staged sections, default 12) and add ThemePageByteCeiling (default 65536); runtime defaults, rc accessors, .ctxrc schema, and the unit text keys (sections, bytes) updated together.

E2 core: knowledge.Health emits two signals from one scan — foldable roots (staging count via disclosure.StagedEntries, so a never-migrated root reads full and a folded one quiets) and heavy pages (bytes over the root AND every theme file, closing the fold-created blindness). Both-fire orders foldable first. Unexported scan helpers split into scan.go; Thresholds/finding types in types.go (file-convention + mixed-visibility audits).

Tests (M1-M7): un-migrated foldable, folded-quiet, heavy theme file, both-fire ordering, convention-measure-is-sections, boundary (>N) and disable (0). Full suite + make lint green.

Spec: specs/progressive-disclosure.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Warning text routes by signal kind: foldable roots lead with /ctx-digest (consolidate/drift demoted to secondary), heavy pages advise split-or-extract-to-tooling. FormatWarnings groups findings by kind and attaches each remedy; the generic remedy block is retired from the template and the now-dead fallback key removed.

New knowledge.Report (no throttle, no relay) and a ctx system check-knowledge --report path the /ctx-remember and /ctx-wrap-up skills call for the live state on demand. thresholds() shared by CheckHealth and Report. Flag wired via flagbind + a system flag desc key; print via write/setup.

Spec: specs/progressive-disclosure.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
…E4-E6)

E4: /ctx-remember runs 'ctx system check-knowledge --report' after recall and surfaces foldable/heavy roots in the readback (read-only); /ctx-wrap-up surfaces them as a next-session suggestion and explicitly never folds inline (the human is leaving). Copilot skills synced.

E6: surface-parity test (M8) — the hook path and the report path derive from one Health scan, so the report text is exactly what the nudge box wraps. Measurement gate (T22) driven on a realistic .context (35-entry LEARNINGS + 91 KB theme file): both signals surface, foldable first, with correct remedies. Milestone gate (T23): make lint 0, go test green, make audit pass. All 23 tasks and every DoD box complete.

Spec: specs/progressive-disclosure.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@josealekhine josealekhine self-assigned this Jul 26, 2026
@josealekhine
josealekhine merged commit 67a0bea into main Jul 26, 2026
17 checks passed
@josealekhine
josealekhine deleted the design/pd-m5-triggers branch July 26, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant