@jaybeeuu/agent-cortex 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/CHANGELOG.md +387 -0
  2. package/README.md +33 -13
  3. package/agents/README.md +22 -10
  4. package/agents/plan/agent.md +2 -2
  5. package/agents/ralph/agent.md +126 -88
  6. package/agents/ralph/claude/frontmatter.json +3 -3
  7. package/agents/ralph/claude/wake.md +46 -0
  8. package/agents/ralph/pi/{polling.md → wake.md} +35 -20
  9. package/agents/ralph-plan/agent.md +23 -11
  10. package/bin/agent-cortex.mjs +66 -4
  11. package/bin/installers/claude.mjs +182 -68
  12. package/bin/installers/pi.mjs +200 -24
  13. package/extensions/agent-guardrails/README.md +1 -1
  14. package/extensions/agent-guardrails/guardrails.ts +1 -1
  15. package/extensions/agent-guardrails/index.ts +1 -1
  16. package/extensions/agent-modes/discover.test.ts +2 -2
  17. package/hooks/claude/scripts/notify.mjs +8 -1
  18. package/lib/cli.mjs +91 -2
  19. package/package.json +27 -3
  20. package/scripts/check-changeset.mjs +4 -0
  21. package/scripts/check-no-sync.mjs +5 -1
  22. package/scripts/lib/compose-agent.mjs +69 -9
  23. package/scripts/lib/fs.mjs +10 -2
  24. package/scripts/lib/migrate.mjs +736 -0
  25. package/scripts/lib/release-gates.mjs +21 -1
  26. package/scripts/lib/skill-frontmatter.mjs +23 -6
  27. package/scripts/lib/skill-links.mjs +52 -0
  28. package/scripts/lib/verify-worker-tree.mjs +25 -0
  29. package/scripts/resolve-publish-command.mjs +4 -0
  30. package/skills/engineering/design-an-interface/SKILL.md +3 -3
  31. package/skills/engineering/grill-with-docs/SKILL.md +3 -5
  32. package/skills/engineering/improve-codebase-architecture/SKILL.md +5 -4
  33. package/skills/engineering/tdd/SKILL.md +5 -7
  34. package/skills/engineering/technical-direction/SKILL.md +5 -5
  35. package/skills/planning/classify-bead/REFERENCE.md +3 -3
  36. package/skills/planning/classify-bead/SKILL.md +14 -9
  37. package/skills/planning/classify-bead/scripts/classify-bead.mjs +5 -4
  38. package/skills/planning/create-task/REFERENCE.md +52 -3
  39. package/skills/planning/create-task/SKILL.md +70 -26
  40. package/skills/planning/create-task/scripts/{create-chores.ts → create-chores.mjs} +48 -23
  41. package/skills/planning/flesh-out-idea/REFERENCE.md +116 -0
  42. package/skills/planning/flesh-out-idea/SKILL.md +146 -0
  43. package/skills/planning/prd-to-tasks/REFERENCE.md +54 -5
  44. package/skills/planning/prd-to-tasks/SKILL.md +22 -16
  45. package/skills/planning/record-idea/FORMAT.md +66 -17
  46. package/skills/planning/record-idea/SKILL.md +48 -24
  47. package/skills/planning/request-refactor-plan/SKILL.md +4 -4
  48. package/skills/planning/spec-to-tickets/SKILL.md +5 -5
  49. package/skills/planning/write-a-prd/SKILL.md +8 -9
  50. package/skills/planning/write-a-ticket/SKILL.md +4 -6
  51. package/skills/productivity/bd-tool/SKILL.md +15 -10
  52. package/skills/productivity/grill-me/SKILL.md +5 -0
  53. package/skills/productivity/init-beads/SKILL.md +3 -3
  54. package/skills/productivity/migration/REFERENCE.md +227 -0
  55. package/skills/productivity/migration/SKILL.md +188 -0
  56. package/skills/productivity/validate-agent-dir/scripts/{validate-agent-dir.ts → validate-agent-dir.mjs} +49 -28
  57. package/skills/productivity/write-a-skill/SKILL.md +5 -5
  58. package/skills/review/maintain-agent-docs/SKILL.md +5 -7
  59. package/skills/review/refactor-skill/SKILL.md +4 -3
  60. package/skills/review/review-security/SKILL.md +3 -5
  61. package/skills/style/style-code/SKILL.md +5 -10
  62. package/skills/style/style-comms/SKILL.md +5 -7
  63. package/skills/style/style-documentation/SKILL.md +5 -6
  64. package/skills/style/style-tests/SKILL.md +5 -7
  65. package/skills/workflow/git-workflow/SKILL.md +28 -4
  66. package/skills/workflow/hitl-collab/SKILL.md +4 -6
  67. package/skills/workflow/plan/SKILL.md +41 -30
  68. package/skills/workflow/ralph/REFERENCE.md +182 -51
  69. package/skills/workflow/ralph/SKILL.md +89 -50
  70. package/skills/workflow/run-pipeline-stage/SKILL.md +72 -71
  71. package/skills/workflow/run-pipeline-stage/playbooks/code.md +11 -0
  72. package/skills/workflow/run-pipeline-stage/playbooks/document.md +12 -0
  73. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +12 -0
  74. package/skills/workflow/run-pipeline-stage/playbooks/review.md +11 -0
  75. package/skills/workflow/run-pipeline-stage/playbooks/verify.md +13 -0
  76. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +73 -1
  77. package/token-map.README.md +9 -4
  78. package/token-map.json +13 -6
  79. package/.agents/skills/style-versioning/SKILL.md +0 -172
  80. package/.changeset/README.md +0 -8
  81. package/.changeset/config.json +0 -11
  82. package/.github/workflows/ci.yml +0 -302
  83. package/.junie/guidelines.md +0 -87
  84. package/.junie/mcp/mcp.json +0 -10
  85. package/AGENTS.md +0 -153
  86. package/agents/ralph/claude/polling.md +0 -31
  87. package/agents-native/ralph.md +0 -203
  88. package/docs/claude-hooks.md +0 -144
  89. package/docs/commit-signing.md +0 -231
  90. package/docs/ideas/auto-model-selection.md +0 -75
  91. package/docs/ideas/ban-content-assertion-tests.md +0 -75
  92. package/docs/ideas/bead-progress-notes-for-session-resumption.md +0 -75
  93. package/docs/ideas/classify-beads-via-deterministic-script-with-agent-fallback.md +0 -70
  94. package/docs/ideas/ctx-alias-version-and-update-commands.md +0 -65
  95. package/docs/ideas/ctx-feedback-command-for-capturing-ideas-from-any-machine.md +0 -67
  96. package/docs/ideas/dedicated-review-tests-skill.md +0 -71
  97. package/docs/ideas/deployment-beads-for-post-merge-pipelines.md +0 -36
  98. package/docs/ideas/design-and-delivery-as-separate-bead-trees/design-and-delivery-as-separate-bead-trees.md +0 -99
  99. package/docs/ideas/enable-signed-commit-enforcement-changesets-bot-commits-must-be-signed.md +0 -42
  100. package/docs/ideas/extension-manifests.md +0 -121
  101. package/docs/ideas/improve-pi-system-prompt.md +0 -43
  102. package/docs/ideas/map-every-cortex-tool-to-a-real-pi-equivalent.md +0 -95
  103. package/docs/ideas/model-selector.md +0 -40
  104. package/docs/ideas/pi-task-memory.md +0 -34
  105. package/docs/ideas/qa-extension.md +0 -43
  106. package/docs/ideas/record-idea-implementation-questions.md +0 -68
  107. package/docs/ideas/record-ideas-as-beads.md +0 -115
  108. package/docs/ideas/self-flushing-session.md +0 -72
  109. package/docs/ideas/state-in-beads-not-md.md +0 -69
  110. package/docs/ideas/subagent-visibility.md +0 -72
  111. package/docs/ideas/task-session-context.local.md +0 -95
  112. package/docs/ideas/task-session-context.md +0 -89
  113. package/docs/ideas/test-data-creation-helpers.md +0 -92
  114. package/docs/ideas/test-planning-stage-bead-in-feature-planning.md +0 -68
  115. package/docs/ideas/unified-ci-pipeline.md +0 -28
  116. package/docs/ideas/unify-the-ticket-and-task-decomposition-workflows.md +0 -71
  117. package/docs/ideas/worktree-housekeeping-for-closed-beads.md +0 -39
  118. package/docs/inspirations.md +0 -33
  119. package/docs/research/disable-model-invocation.md +0 -82
  120. package/docs/research/gas-city-research.md +0 -256
  121. package/docs/research/skill-design-research.md +0 -286
  122. package/docs/research/skill-improvements-analysis.md +0 -117
  123. package/docs/research/skill-patterns-research.md +0 -24
  124. package/docs/skills/skill-anatomy.md +0 -200
  125. package/docs/technical-direction/harness-config.md +0 -177
  126. package/docs/technical-direction/migration-execution-labels.md +0 -177
  127. package/docs/user-preferences.md +0 -17
  128. package/extensions/agent-guardrails/tsconfig.json +0 -12
  129. package/extensions/agent-modes/tsconfig.json +0 -12
  130. package/extensions/output-style/tsconfig.json +0 -12
  131. package/extensions/session-start/tsconfig.json +0 -12
  132. package/extensions/skill-stats/pnpm-lock.yaml +0 -329
  133. package/extensions/skill-stats/tsconfig.json +0 -12
  134. package/extensions/subagent/agents/planner.md +0 -37
  135. package/extensions/subagent/agents/reviewer.md +0 -35
  136. package/extensions/subagent/agents/scout.md +0 -50
  137. package/extensions/subagent/agents/worker.md +0 -24
  138. package/extensions/subagent/prompts/implement-and-review.md +0 -10
  139. package/extensions/subagent/prompts/implement.md +0 -10
  140. package/extensions/subagent/prompts/scout-and-plan.md +0 -9
  141. package/extensions/subagent/tsconfig.json +0 -12
  142. package/pi/keybindings.json +0 -3
  143. package/pi/settings.json +0 -34
  144. package/pnpm-workspace.yaml +0 -14
  145. package/skills/planning/create-task/scripts/package.json +0 -14
  146. package/skills/planning/create-task/scripts/pnpm-lock.yaml +0 -342
  147. package/skills/planning/create-task/scripts/tsconfig.json +0 -12
  148. package/skills/planning/record-idea/scripts/new-idea.sh +0 -89
  149. package/skills/productivity/validate-agent-dir/scripts/package.json +0 -15
  150. package/skills/productivity/validate-agent-dir/scripts/pnpm-lock.yaml +0 -329
  151. package/skills/productivity/validate-agent-dir/scripts/pnpm-workspace.yaml +0 -2
  152. package/skills/productivity/validate-agent-dir/scripts/tsconfig.json +0 -19
  153. package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.test.ts +0 -317
  154. package/skills/workflow/run-pipeline-stage/REFERENCE.md +0 -22
  155. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.test.ts +0 -682
  156. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.ts +0 -588
  157. package/skills/workflow/run-pipeline-stage/scripts/package.json +0 -15
  158. package/skills/workflow/run-pipeline-stage/scripts/pnpm-lock.yaml +0 -342
  159. package/skills/workflow/run-pipeline-stage/scripts/pnpm-workspace.yaml +0 -2
  160. package/skills/workflow/run-pipeline-stage/scripts/tsconfig.json +0 -12
  161. package/test/classify-bead.test.mjs +0 -277
  162. package/test/claude-installer.test.mjs +0 -308
  163. package/test/cli.test.mjs +0 -314
  164. package/test/create-chores.test.mjs +0 -85
  165. package/test/fake-bd.test.mjs +0 -72
  166. package/test/fs.test.mjs +0 -76
  167. package/test/helpers/fake-bd.mjs +0 -87
  168. package/test/helpers/fake-claude.mjs +0 -152
  169. package/test/helpers/fake-pi.mjs +0 -132
  170. package/test/installer.test.mjs +0 -806
  171. package/test/notify-hook.test.mjs +0 -63
  172. package/test/pending-gates.test.mjs +0 -147
  173. package/test/pi-installer.test.mjs +0 -785
  174. package/test/pi-register.test.mjs +0 -342
  175. package/test/pi-sweep.test.mjs +0 -619
  176. package/test/release-gates.test.mjs +0 -190
  177. package/test/skill-frontmatter.test.mjs +0 -137
  178. package/test/verify-worker-tree.test.mjs +0 -120
@@ -1,121 +0,0 @@
1
- # Idea: extension-manifests
2
-
3
- ## Status
4
- **Superseded (2026-09-22)** — the bespoke per-harness manifest model was replaced by each
5
- harness's native dependency fields plus committed settings templates. See the decision memo
6
- [`docs/technical-direction/harness-config.md`](../technical-direction/harness-config.md). The
7
- prune TUI was rejected (see "Prune rejected") and the proposed declared-vs-installed diff was
8
- dropped — `agent-cortex install <harness>` reconciles instead.
9
-
10
- The mechanism recorded under "What shipped" has since been removed (2026-10-24,
11
- `agnt-ctx-7kru.1`): `pi.packages`, `lib/pi-packages.mjs` and `--no-provision` are gone, and the
12
- required pi packages now travel inside the staged package at `~/.agent-cortex/pi` instead of
13
- being provisioned into pi's user scope.
14
-
15
- ## Created
16
- 2026-08-25
17
-
18
- ## Problem
19
- PI extensions and Claude/Copilot plugins are installed individually (`pi install <ext>`) and
20
- live implicit in the machine's state (`~/.pi/agent/extensions/`) with no declared manifest of
21
- what the author uses or where it came from. A fresh machine, clean `~/.pi`, or a failed update
22
- leaves the environment without the expected extensions. The toolset isn't reproducible and
23
- isn't documented anywhere in the author's repos. Experimenting with an extension (install, try,
24
- remove) is also all manual, and there is no view of how the machine differs from the declared set.
25
-
26
- ## Who benefits
27
- The author. Installing/updating agent-cortex becomes a reliable way to restore a known PI +
28
- Claude environment (agent-cortex + declared extensions in one step). The manifests document and
29
- reproduce the toolset across machines. A declared-vs-installed diff makes drift visible and
30
- repairable.
31
-
32
- ## Proposed outcome
33
- agent-cortex ships **committed extension manifests** (reviewed and stored on GitHub) declaring
34
- which extensions to install — **per harness**: one manifest for PI extensions, one for
35
- Claude/Copilot plugins. On install or update of agent-cortex, it reads the manifests and
36
- installs the declared extensions. The manifests are the single source of truth.
37
-
38
- Key decisions from the interview:
39
-
40
- 1. **No monitoring** — nothing observes installs, and the CLI never writes the manifests.
41
- Adding an extension = edit the manifest, commit it, ship it. This keeps the source of truth
42
- in GitHub where it belongs (and gets the usual PR/review flow).
43
- 2. **Per-harness manifests** — separate records for the pi harness vs the Claude harness, each
44
- carrying the extension source (git URL / package name) for that harness's installer. The
45
- install-on-update path handles each harness with its own mechanism.
46
- 3. **Prune CLI with a TUI** — a CLI command (e.g. `agent-cortex ext prune`) opens an interactive
47
- TUI listing locally-installed extensions; selecting one **uninstalls** it from the local
48
- environment. Removing from the manifest is done manually on GitHub. This supports the
49
- experimentation loop: install → try → prune locally, then curate the manifest separately.
50
- **Reversed 2026-09-21** — the harnesses already provide uninstall; see "Prune rejected".
51
-
52
- agent-cortex's own bundled extensions (auto-discovered via `pi install`, e.g. `skill-stats`)
53
- are deliberately excluded from the manifests — only third-party extensions are declared.
54
-
55
- ## What shipped (2026-09-18)
56
-
57
- The pi half of the problem is solved without a new manifest file: the packages agent-cortex
58
- needs are declared in the **existing** package manifest at `package.json` → `pi.packages`, and
59
- `agent-cortex install pi` provisions them through the `pi` CLI into the pi user scope
60
- (`lib/pi-packages.mjs`). Reusing the shipped manifest beat introducing a parallel per-harness
61
- manifest file, which would have duplicated a declaration agent-cortex already publishes.
62
-
63
- Three properties are deliberate and should survive future changes: provisioning is
64
- **idempotent** (a package both declared in `~/.pi/agent/settings.json` and present in the pi npm
65
- store is skipped), **degrades gracefully** (a missing `pi` CLI or a failed install warns and the
66
- agent install still succeeds), and is **opt-out** via `--no-provision` — automatically off for the
67
- `--output` generate-only form, and never run on `--dry-run`.
68
-
69
- Still unbuilt: the Claude/Copilot manifest. `pi/settings.json` also lists these
70
- packages for the symlinked-checkout workflow (where pi auto-installs them); that redundancy is
71
- intentional until the manifest model is extended to both harnesses.
72
-
73
- ## Prune rejected (2026-09-21)
74
-
75
- The prune half was implemented (F6, `agnt-ctx-17hc`) and then rejected: PR #142 was closed
76
- unmerged and its branch deleted. The harnesses already own extension package management —
77
- `pi install/remove/list` and `claude plugin install/uninstall/list --json` — so an interactive
78
- wrapper around uninstall added no capability. The implementation's recorded justification that
79
- "pi does not have a listing API" is **wrong**: `pi list` exists (verified on pi 0.85.1) and lists
80
- installed packages from user and project settings, so the hand-rolled settings reader duplicated
81
- it. What is genuinely missing is not an uninstall UI but reconciliation between the declared set
82
- and the installed set — now delivered by materialising the committed settings template at
83
- install time (see the [harness-config memo](../technical-direction/harness-config.md)).
84
-
85
- ## Validity check
86
- - Evidence we already have: agent-cortex already has an install surface to hang this on
87
- (`pi install` package discovery for the pi harness, plus the existing `bin/agent-cortex.mjs`
88
- install command and `postinstall` script). The repo already carries a `plugin.json` (Claude
89
- harness) alongside `package.json` (pi harness), showing the per-harness split is natural.
90
- - Riskiest assumption: that an automated install-on-update of declared extensions is safe and
91
- desirable (auto-installing on every update could surprise, or fail mid-flight on a new
92
- machine lacking auth/network). The store-shape question that gated the (now rejected) prune
93
- TUI is resolved: both harnesses expose a listing API (`pi list`; `claude plugin list --json`).
94
- - What would invalidate this idea: if auto-install-on-update proves too disruptive (better as
95
- an explicit `agent-cortex ext install` command). The prune half is already invalidated — see
96
- "Prune rejected".
97
-
98
- ## Constraints
99
- - Manifests live in this repo, committed via the normal PR flow — the CLI never edits them.
100
- - Install-on-update must be idempotent and safe to skip/fail gracefully (no hard breakage of
101
- agent-cortex's own install on extension failure).
102
- - Follow the repo's extension conventions where relevant (lightweight, no internal LLM calls).
103
- - If any local data is persisted (e.g. prune history), write to `~/.pi/agent-cortex/`.
104
-
105
- ## Next validation step
106
- None — the direction is settled. The store question is answered (both harnesses expose a listing
107
- API: `pi list`; `claude plugin list --json`), and the manifest model is superseded by native
108
- dependency fields plus committed settings templates. See the
109
- [harness-config memo](../technical-direction/harness-config.md) for the replacement.
110
-
111
- ## Notes
112
- Recorded 2026-08-25. The idea was refined during the interview: initially framed as
113
- "record the extensions I use" (observer-based), corrected to a **committed manifest** model —
114
- recording happens by editing + committing, not by monitoring. The manifest stays GitHub-managed
115
- (the CLI never writes it); the prune CLI was rejected, so local uninstall stays with the
116
- harnesses' own commands. This idea is adjacent to `record-ideas-as-beads`: both make
117
- agent-cortex the declared source of truth for the author's environment and workflow.
118
-
119
- **Superseded 2026-09-22.** The declared toolset is now expressed through `package.json`
120
- dependencies (required) and committed settings templates (optional), not a bespoke manifest —
121
- see the [harness-config memo](../technical-direction/harness-config.md).
@@ -1,43 +0,0 @@
1
- # Idea: Improve PI System Prompt
2
-
3
- ## Status
4
- Backlog idea (not implementation-ready) — two slices implemented as pi extensions:
5
- `agent-guardrails` (circuit-breakers, check-in triggers, atomic-change discipline) and
6
- `output-style` (action-first reply shape, Simplified Technical English, restated context,
7
- shipped to pi via the system prompt and to Claude via a managed `CLAUDE.md` section).
8
- The rest of the idea is unscoped.
9
-
10
- ## Why it might be useful
11
- PI's current system prompt is weak. Agents consistently get off track, spend excessive tokens spinning their wheels or going off on tangents, fail to check in when problems are hit, and generally behave like inexperienced code goblins. This wastes tokens, slows down task completion, and forces the user to constantly redirect the agent. A stronger system prompt would produce more focused, disciplined agents that know when to stop and ask.
12
-
13
- ## How we might do it
14
- Build improved behavioural instructions into agent-cortex — layered on top of or replacing PI's default system prompt. Key improvements:
15
-
16
- 1. **Loop prevention / circuit-breakers** — hard limits on retry attempts (e.g. 2-attempt limit before stopping and asking), no repeated tool execution without rationale
17
- 2. **Task-focus discipline** — stronger scoping instructions, no tangential refactoring, atomic changes
18
- 3. **Check-in triggers** — explicit rules for when the agent must stop and present options to the user
19
-
20
- A Gemini-generated execution protocol prompt exists as a possible starting point (see Notes), but will need significant customisation for agent-cortex.
21
-
22
- ## When to think about it
23
- - Land the current work first (refactor-to-template epic, bead workflow polish, CI/CD pipeline)
24
- - **Next priority after current work** — this is urgent-ish
25
-
26
- ## Priority
27
- High — after current work lands. Directly impacts daily productivity and token efficiency.
28
-
29
- ## Open questions
30
- - Layer on top of PI's default prompt, or replace it entirely?
31
- - Should PI's current system prompt be reviewed for nonsense that can be chopped out?
32
- - Which guardrails from the Gemini starter are genuinely useful vs redundant with existing skills (e.g. `git-workflow` already covers destructive commands, `style-code` covers scope discipline)?
33
-
34
- ## Notes
35
- - **Second slice (settled)**: reply shape is a separate extension from task discipline.
36
- `agent-guardrails` decides whether work continues; `output-style` decides how the result
37
- is reported (STE per ASD-STE100, action first, context restated — never a bead or phase
38
- ID cited alone). Both are stable constants appended on `before_agent_start`.
39
- - **Precedence (settled by the first slice)**: the generic circuit-breakers yield to a structured
40
- workflow — a skill or pipeline stage with its own explicit retry and check-in rules wins.
41
- - **Gemini starter prompt** exists (see conversation from 2026-08-05) covering loop prevention, action scope, context management, execution workflow order, and working state maintenance. Useful starting material but needs heavy customisation.
42
- - **Incompatibility to fix**: the starter's "Working State Maintenance" section proposes `.pi/PLAN.md` files for complex tasks. This is incompatible with agent-cortex — we use **beads (bd)** for task tracking and pipeline stages, not flat markdown plan files. This section needs to be replaced with bead-aware equivalents (e.g. updating bead notes, using pipeline stage state).
43
- - **Overlap with existing skills**: several guardrails already exist in agent-cortex skills (`git-workflow`, `style-code`, `run-pipeline-stage`). The biggest gaps are **loop prevention / circuit-breakers** and **check-in discipline** — these aren't enforced anywhere today.
@@ -1,95 +0,0 @@
1
- # Idea: Map every cortex tool to a real PI equivalent
2
-
3
- ## Status
4
- Slice 1 shipped 2026-09 via bead agnt-ctx-f4au: `ask_user` → `ask_questions` and
5
- `skill` → `read` remapped in `token-map.json`; agent-modes startup warnings gone,
6
- verified in real pi sessions. Open follow-ons: full coverage audit of every frontmatter
7
- tool; dedicated skill-tool candidate if prompting proves insufficient.
8
-
9
- ## Created
10
- 2026-09-08
11
-
12
- ## Problem
13
- On every pi startup, agent-modes warns once per declared tool that has no pi mapping:
14
- `[agent-modes] Tool "ask_user" has no PI equivalent — omitted from the tool set` (plus
15
- `{{TOOL:ask_user}}` token drops). Today `ask_user` and `skill` produce this noise across
16
- the `ralph-plan`, `plan`, and `strategy` modes.
17
-
18
- Worse than noise: dropping `ask_user` **silently removes interactive grilling** from
19
- `ralph-plan`/`plan` in pi — a functional gap disguised as a warning. The root cause is
20
- that `token-map.json` declares `pi: null` for `ask_user` and `skill`, and agent-modes
21
- omits null-mapped tools rather than mapping them to the real pi equivalent.
22
-
23
- ## Who benefits
24
- - The author, in every pi session: clean startup, no recurring warnings.
25
- - `plan`/`strategy`/`ralph-plan` in pi: regain interactive user questioning (via
26
- `ask_questions`) and a documented, reliable skill-loading path.
27
- - Anyone maintaining cortex: a codified principle so future harness gaps surface loudly
28
- and are resolved deliberately instead of silently degrading agent capability.
29
-
30
- ## Proposed outcome
31
- - **Principle**: every tool a cortex agent declares in its frontmatter must have a real
32
- pi-side representation — either a native pi tool (mapped in `token-map.json`) or a pi
33
- tool-extension package (found, adopted, or designed). An unmapped tool should be a
34
- loud error, not a startup warning. "If pi needs more extensions to work, we add more."
35
- - **Coverage audit**: every tool across `agents/*/pi/frontmatter.json` checked against
36
- the pi toolset; each gap resolved by mapping or by adopting/designing an extension.
37
- - **Immediate remaps**: `ask_user` → `ask_questions` (pi's native structured-questions
38
- tool); `skill` → documented as "read the listed SKILL.md path" for now (pi has no
39
- skill tool — skills are context-listed + read-loaded), with a dedicated skill tool
40
- recorded as a follow-on design candidate if prompting proves insufficient.
41
-
42
- ## Validity check
43
- - Evidence we already have:
44
- - The warnings reproduce on every pi startup in agent-nexus (seen 2026-09-08).
45
- `token-map.json` maps both `ask_user` and `skill` to `pi: null`, and its notes claim
46
- pi ships no ask tool and no skill tool.
47
- - That note is outdated for the questioning case: pi's equivalent is `ask_questions`, a
48
- structured user-question tool provided by the **pi-questions** package (`pi install
49
- npm:pi-questions`; declared in the author's pi/settings.json) — present in this session's
50
- toolset, but extension-provided, not native to pi. Mapping `ask_user` to it restores
51
- grilling in pi modes *when the package is installed*; making the package install
52
- reproducible is the extension-manifests idea (see `extension-manifests.md`).
53
- - pi's own skills docs (skills.md, step 3) confirm skills load via `read` and concede
54
- "models don't always do this" — so a doc-now mapping is legitimate but the
55
- self-invocation gap is real and acknowledged upstream.
56
- - Precedent for external tools on pi exists: the pi-hypa package adds `hypa_*` tools
57
- and context-mode adds `ctx_*` tools; distribution is `pi install npm:@...`.
58
- - Riskiest assumption: that `ask_questions` is a faithful-enough substitute inside
59
- restricted mode tool lists — i.e. that mode tool filters will admit it and the
60
- agents actually exercise mid-run questioning in pi.
61
- - What would invalidate this idea:
62
- - If remapping `ask_user` → `ask_questions` does not restore questioning in pi modes
63
- (e.g. mode tool lists are a hard allow-list that excludes it), the headline fix is
64
- a no-op and the problem needs a different shape.
65
- - If a package scan finds no existing skill tool AND prompting proves sufficient in
66
- practice, the "skill tool later" half should be dropped or demoted to a note.
67
-
68
- ## Constraints
69
- - Cortex conventions: extensions stay lightweight (no internal LLM calls); agents/skills
70
- come from composable sources; `token-map.json` is the single source of truth for
71
- cross-harness tool naming; changes ship via `pnpm changeset`.
72
- - pi intentionally has no permission popups — the mapping must map onto what pi is, not
73
- force pi semantics to change.
74
- - agent-modes currently warns-and-omits null tools and passes unknown names through;
75
- flipping gaps to loud errors changes that contract, and generated copilot/claude
76
- output (which already has real mappings) must stay stable.
77
-
78
- ## Next validation step
79
- - (done — shipped via agnt-ctx-f4au) Remap `ask_user` → `ask_questions` in `token-map.json`, then run a pi session in
80
- `ralph-plan`/`plan` mode and confirm the tool is available and the startup warning is
81
- gone. If it works, ship that remap first (smallest verifiable slice).
82
- - Scan npm/pi packages for an existing skill-invocation tool before designing one —
83
- adopt over invent (same stance as the user's marketplace instinct).
84
- - Run the audit: list every tool across `agents/*/pi/frontmatter.json` and mark each as
85
- mapped-native / mapped-extension / unmapped.
86
-
87
- ## Notes
88
- - Current pi-mode declarations: `ralph-plan` = bash view edit create grep glob ask_user;
89
- `plan` adds task read_agent skill; `strategy` adds ask_user skill web_fetch.
90
- - `token-map.json` notes for `ask_user` ("pi intentionally ships no permission-popup/ask
91
- tool") and `skill` ("pi discovers skills but the agent loads them via read and
92
- /skill:name") both need updating if the mappings change.
93
- - pi keeps skill affordances present without a skill tool via the always-listed
94
- "Available skills — invoke when relevant" context block; the doc-now `skill` mapping
95
- builds on that existing mechanism.
@@ -1,40 +0,0 @@
1
- # Idea: model-selector
2
-
3
- ## Status
4
- Backlog idea (not implementation-ready)
5
-
6
- ## Created
7
- 2026-07-12
8
-
9
- ## Problem
10
- Selecting the right model for a task is manual and brittle. When a model is unavailable (rate-limited, down, or lacking capability), there's no automatic fallback. You have to know which model IDs to type into `/model` and remember which providers offer which capabilities.
11
-
12
- ## Who benefits
13
- Anyone using PI who runs multiple models/providers. The extension makes model selection declarative: "I want to write code" → extension picks the best available model (and falls back if limits are hit).
14
-
15
- ## Proposed outcome
16
- A PI extension that defines an abstraction for selecting models based on task/use case. Users declare "use case → model(s) with fallbacks" in config, and the extension handles selection and failover automatically.
17
-
18
- Key capabilities:
19
- - **Use-case profiles**: e.g. `code`, `chat`, `review`, `architect` — each maps to a primary model + ordered fallbacks
20
- - **Automatic fallback**: if the primary model returns a 429 or error, drop to the next in the chain
21
- - **Task-based selection**: think "I want this model to write code" instead of choosing a specific model ID
22
- - **Configurable**: profiles defined in settings.json or a dedicated config file
23
-
24
- ## Validity check
25
- - Evidence we already have: The existing `tiny-model.ts` lib in this repo already shows the pattern of configuring a model by provider/id string and looking it up via `modelRegistry.find()`. The PI extension API supports `before_provider_response` (for catching 429s) and `model_select` events.
26
- - Riskiest assumption: That use-case profiles are a useful abstraction — users may prefer to just name a model family and let fallback be implicit.
27
- - What would invalidate this idea: If PI adds built-in model routing/fallback, or if users find the abstraction adds confusion rather than removing it.
28
-
29
- ## Constraints
30
- - Must not add LLM calls internally (per extension conventions in AGENTS.md)
31
- - Must work with the existing `modelRegistry` API — no monkey-patching
32
- - Storage/config should go in settings.json or `~/.pi/agent-cortex/` (global, cross-project)
33
-
34
- ## Next validation step
35
- Sketch the config schema and test it against real usage patterns. Does the profile abstraction hold up for the models/providers you actually use?
36
-
37
- ## Notes
38
- - Initial conversation during planning session 2026-07-12. Idea recorded as backlog, to be fleshed out when time permits.
39
- - Could draw on patterns from OpenRouter's routing and the existing `modelOverrides` in models.json.
40
- - The `notify` extension already intercepts provider responses — similar pattern for catching rate limits.
@@ -1,34 +0,0 @@
1
- # Idea: PI Task Memory Skill
2
-
3
- ## Status
4
- Backlog idea (not implementation-ready)
5
-
6
- ## Why it might be useful
7
- PI has no built-in task memory. Agents lose context between sessions — they can't track what a task has done, what decisions were made, or where they left off. A skill that persists task-scoped knowledge in structured markdown would let agents pick up work without re-discovering context from scratch, and give humans a readable audit trail they can review or promote into real documentation.
8
-
9
- ## How we might do it
10
- **Possibly build on top of `bd remember`** rather than creating a separate storage system. Worth exploring whether `bd remember`'s existing infrastructure (persistence, cross-session survival, auto-injection) could be extended with task-scoping and structure, vs building something standalone.
11
- - **Task-linked** — memories keyed to specific bead/task IDs so they can be retrieved in context
12
- - **Progressively discoverable** — the agent recalls relevant memories as it picks up work, not all at once
13
- - **Structured** — consistent format that's easy to scan, edit, or promote
14
- - **Promotable** — easy to elevate a memory into real repo documentation (e.g. `docs/`, `AGENTS.md`) once it's proven stable
15
-
16
- If `bd remember` turns out to be the right foundation, the skill would add **task-scoping discipline, structure, and a promotion workflow** on top. But that's to be determined.
17
-
18
- ## When to think about it
19
- - After the current skill set stabilises (refactor-to-template work, bead workflow, CI/CD pipeline)
20
- - Not blocked by anything, but benefits from a stable foundation
21
-
22
- ## Priority
23
- Low / backlog — useful but not urgent. Current memory surfaces (bd remember, context-mode) cover some of the gap already.
24
-
25
- ## Open questions
26
- - What triggers writing a memory? (Agent decides? Skill hook on task close? Specific prompts?)
27
- - What does "progressively discoverable" mean in practice — agent reads task memories at session start, or on-demand when picking up a task?
28
- - What does "elevate into docs" look like — export memory to markdown file, or just reference the memory in docs?
29
- - How to structure memory keys for task-scoping? (e.g. `task-<bead-id>-<topic>`, or a naming convention?)
30
-
31
- ## Notes
32
- - **What bd remember already provides**: persistent cross-session memories, auto-injection at `bd prime`, searchable via `bd memories <keyword>`, stored in Dolt database.
33
- - **Worth exploring**: could this skill layer task-scoping discipline (memories keyed to bead IDs), structured format, progressive discovery (not all memories at once), and a promotion workflow on top of `bd remember`? Or does it need its own system?
34
- - Could be a **PI extension** (event hooks) rather than a skill (invoked on-demand) if memories should be written automatically during task work.
@@ -1,43 +0,0 @@
1
- # Idea: qa-extension
2
-
3
- ## Status
4
- Backlog idea (not implementation-ready)
5
-
6
- ## Created
7
- 2026-07-12
8
-
9
- ## Problem
10
- When an agent needs clarification during a task (e.g. during a grilling session, resolving ambiguity, or making a recommendation), it has no structured way to ask the user a question and wait for an answer. The current workaround is unstructured prompting — the agent guesses, rambles, or proceeds with incomplete information. This makes grilling sessions less productive and wastes turns.
11
-
12
- ## Who benefits
13
- Anyone using PI agents for interactive work — especially during planning, grilling, and design sessions where the model needs to ask a series of questions one at a time and get focused answers.
14
-
15
- ## Proposed outcome
16
- A PI extension that registers a `qa` or `ask` tool that the LLM can call to ask the user a question. The tool:
17
- - Presents the question (and optionally multiple-choice options or a recommendation)
18
- - Pauses the agent and waits for the user's response
19
- - Returns the user's answer to the model so it can continue
20
- - Supports multi-turn Q&A sessions (series of questions)
21
-
22
- This mirrors the built-in `ask_clarification` / `question` tools in Claude Code, GitHub Copilot Chat, and similar coding agents.
23
-
24
- ## Validity check
25
- - Evidence we already have: The PI extension API supports custom tools with user interaction via `ctx.ui` (input, confirm, select). The `subagent` extension already demonstrates complex async tool patterns. Claude Code and Copilot both ship this — it's a proven pattern.
26
- - Riskiest assumption: That the tool execution model in PI can support a "pause and wait for user input" flow without blocking the agent loop awkwardly.
27
- - What would invalidate this idea: If PI adds a built-in `ask_user` tool, or if the UX of blocking the agent loop for input feels worse than the current unstructured approach.
28
-
29
- ## Constraints
30
- - Must work in both TUI and RPC modes (graceful fallback in non-interactive modes)
31
- - Should support at minimum: free-text input, confirm/deny, and multiple-choice selection
32
- - Questions and answers should be visible in the session history so they survive compaction
33
- - Must handle abort (Ctrl+C mid-question) gracefully
34
-
35
- ## Next validation step
36
- 1. **Investigate existing extensions first** — search PI's built-in tools, extension registry, and community repos for an existing `ask`/`qa`/`question` tool before building. May already be available.
37
- 2. If no existing extension: check the PI tool execution model to see if a custom tool can return a partial result and then receive follow-up input from the user. Look at how `ctx.ui.input()` and `ctx.ui.confirm()` behave inside tool execution — can they block and return, or do they need a different pattern?
38
-
39
- ## Notes
40
- - **Needs investigation** — check for existing PI extensions/tools before building.
41
- - Initial conversation 2026-07-12. Motivated by making grilling sessions more efficient — the grill-me skill asks one question at a time, and a structured Q&A tool would make that flow tighter.
42
- - Related to `grill-me` skill (`skills/productivity/grill-me/SKILL.md`) — this extension could become the runtime that grill-me delegates its questioning to.
43
- - Possible names: `/ask`, `qa`, `question` tool.
@@ -1,68 +0,0 @@
1
- # Idea: record-idea-implementation-questions
2
-
3
- ## Status
4
- Folded into bead `agnt-ctx-s5xd.2.2` (2026-09-22) — the `record-idea` bead rewrite absorbs these
5
- questions and the `## Design so far / provenance` section. Not a standalone bead.
6
-
7
- ## Created
8
- 2026-08-30
9
-
10
- ## Problem
11
- The `record-idea` interview captures *why / how / when / priority* but not enough about the
12
- implementation to give a recorded idea a sufficient shape. Ideas often arrive with backstory —
13
- they've come from somewhere (a previous session, a conversation, a pain point in another
14
- skill), they carry partial design thoughts or ruled-out approaches, and a bare title plus
15
- "how we might do it" loses that detail. The record ends up thinner than the thinking that
16
- produced it.
17
-
18
- ## Who benefits
19
- Anyone reading an idea record later (the author, plan agents, ralph) — a record with an
20
- implementation shape and its provenance is far easier to pick up than one that restates the
21
- title. The author also saves re-explaining context: capture it once, at the source.
22
-
23
- ## Proposed outcome
24
- Extend the `record-idea` interview and template:
25
-
26
- 1. **A fixed, short set of implementation questions** baked into the interview — roughly:
27
- - Rough mechanism: what shape would the implementation take (skill / extension / agent /
28
- script / convention)?
29
- - Known constraints or tradeoffs already spotted?
30
- - Existing design thoughts: anything already designed, sketched, or ruled out?
31
- 2. **A couple of adaptive follow-ups** when the fixed answers open a thread worth pulling —
32
- but explicitly bounded: this is capture, not solutionising. The moment the conversation
33
- drifts into implementation detail, stop and record.
34
- 3. **New template section** — e.g. `## Design so far / provenance` — where pre-existing
35
- thoughts (where the idea came from, partial designs, discarded options) are recorded so
36
- they survive under the title instead of being lost.
37
-
38
- ## Validity check
39
- - Evidence we already have: the last few recorded ideas (self-flushing-session,
40
- state-in-beads-not-md) arrived with real backstory — provenance and pre-existing design
41
- choices were captured only because the session happened to cover them; the skill itself
42
- doesn't ask. The existing interview already draws out why/how/when/priority, so adding two
43
- more question groups is a small, natural extension.
44
- - Riskiest assumption: the balance between "capture shape" and "solutionising session".
45
- Too many follow-ups and the interview bloats; the record becomes a design doc and the
46
- author resists using the skill. Needs an explicit off-ramp ("enough — record it").
47
- - What would invalidate this idea: if the fixed questions mostly produce "unknown / not
48
- thought about yet" answers — then the added friction isn't buying anything and the template
49
- section stays empty. Watch whether follow-ups actually surface design thoughts in practice.
50
-
51
- ## Constraints
52
- - Keep the interview fast: a couple of questions, a couple of bounded follow-ups, then record.
53
- - Must not turn into a solutionising session — capture existing thinking, don't generate new
54
- design.
55
- - Lands naturally alongside the `record-ideas-as-beads` rewrite of `record-idea` (bead-based
56
- creation): this skill change rides that migration rather than forking it.
57
-
58
- ## Next validation step
59
- Fold the fixed questions + `## Design so far / provenance` section into `record-idea` next
60
- time it's exercised (or during the record-ideas-as-beads rewrite), then check the next few
61
- records: did they capture backstory that would otherwise have been lost, and did the
62
- interview stay short?
63
-
64
- ## Notes
65
- Recorded 2026-08-30 (P2). Applies to the current file-based flow and the future bead-based
66
- flow (`record-ideas-as-beads` plans interview → `bd create --notes ...`; the provenance
67
- section maps into `--notes` with markers). Explicitly a capture improvement, not a design
68
- step — the line is: record what the user already thinks, don't co-design with them.
@@ -1,115 +0,0 @@
1
- # Idea: record-ideas-as-beads
2
-
3
- ## Status
4
- Fleshed out 2026-08-25 — design decisions locked in an interview; not yet implemented.
5
-
6
- ## Created
7
- 2026-08-25
8
-
9
- ## Problem
10
- Ideas currently live as loose markdown files in `docs/ideas/`. This sits awkwardly alongside
11
- the rest of the workflow, which is almost entirely bead-based (bd). Because ideas aren't beads,
12
- they can't be searched with `bd label`, can't express relationships/dependencies to real tasks,
13
- can't be given priority that surfaces alongside other work, and can't sync to remote via
14
- `bd dolt push`. There's no clean promotion path from "idea" to "epic" to "executable task".
15
-
16
- ## Who benefits
17
- The author's daily planning loop. Ideas are the beginning of epics, so making them first-class
18
- beads gives a single coherent backlog where an idea can grow relationships to the tasks it
19
- spawns. The plan/agent-nexus agents benefit too: agent-nexus will eventually schedule work
20
- through planning stages (not just execution), and a beads-native idea record gives it a clean
21
- input to plan against.
22
-
23
- ## Proposed outcome
24
- Record ideas as beads labelled `kind:idea`, replacing `docs/ideas/*.md` entirely (bead-only —
25
- files deleted after migration). `bd` already supports labels natively (`bd create -l`,
26
- `bd label add/list`). An idea bead maps directly to an epic; promoting it means spawning task
27
- beads as children and letting the idea bead become the epic node.
28
-
29
- ## Fleshed-out design (decided 2026-08-25)
30
-
31
- ### Label & identification
32
- - **`kind:idea` label** marks idea beads. Ideas do NOT use `deferred` status — they stay
33
- `open` so they're visible to idea tooling; hiding from actionable work is done by exclusion,
34
- not status.
35
- - **ralph excludes them**: ready queries use `bd ready --exclude-label kind:idea`
36
- (verified: `bd ready` supports `--exclude-label`). Idea beads never appear as claimable work.
37
- - Optional companion labels: `priority:<0-4>`, `epic:<id>` once promoted.
38
-
39
- ### Flesh-out workflow (the skill that consumes them)
40
- There should be a **flesh-out skill** (e.g. `flesh-out-idea`) that answers: *"which idea beads
41
- are ready to be fleshed out?"* This is `bd ready -l kind:idea` — the blocker-aware ready query
42
- scoped to ideas. Because `bd ready` already respects dependencies, an idea bead that
43
- `depends-on` in-flight work (e.g. "needs unified-ci-pipeline landed first") naturally shows as
44
- *not ready* until its deps close. That's exactly the semantics wanted:
45
- - `bd ready -l kind:idea` → list & pick an idea ready for fleshing.
46
- - The skill runs the record-idea-style interview (why / how / when / priority) at deeper depth,
47
- updating the bead's description/design/notes as the idea ripens.
48
- - Once fleshed out enough, the idea can be promoted (below).
49
-
50
- ### Promotion path: idea → epic → tasks
51
- Parent-child hierarchy (chosen over labels+deps only):
52
- 1. Idea bead starts with `kind:idea`, type defaulted appropriately (still `task` type, or set
53
- `epic` type on promotion).
54
- 2. On promotion: `bd label add <idea> epic:<idea-id>` (or flip to an epic label), then spawn
55
- task beads with `--parent <idea-id>` — children inherit the epic relationship natively.
56
- 3. The idea bead becomes the epic node; its children are the executable tasks. Closing the
57
- children resolves to the epic closing.
58
-
59
- ### Content model (bead fields)
60
- Map the current idea-template sections onto bd fields:
61
- | md template field | bd field |
62
- |---|---|
63
- | Title | `--title` |
64
- | Problem / Why | `--description` |
65
- | How we might do it | `--design` |
66
- | When / Priority / Validity / Constraints / Notes | `--notes` (structured, keep section markers) |
67
- | anything referential | `--context` |
68
-
69
- Multiple sections per field use explicit markers (`## Validity check`, etc.) inside the field
70
- so the flesh-out interview can find/update them later.
71
-
72
- ### Skill changes
73
- - **`record-idea`**: replace scaffold-file flow (`new-idea.sh` → `docs/ideas/x.md`) with bead
74
- creation: interview → `bd create "<title>" -l kind:idea -d "<why>" --design "<how>"
75
- --notes "<when/priority/validity>"`. Keep the interview; drop the markdown scaffold script.
76
- - New **`flesh-out-idea`** skill (see above) — validates readiness (`bd ready -l kind:idea`),
77
- picks an idea, drives the deepening interview, updates the bead, optionally promotes.
78
-
79
- ### Migration
80
- - Bulk-migrate the existing `docs/ideas/*.md` records to beads: read each file, map sections to
81
- bd fields, `bd create -l kind:idea`, preserve priority. Run as a one-off (manual or scripted).
82
- - Then **delete `docs/ideas/`** — bead-only going forward.
83
- - Update `AGENTS.md` + any stale references that point at `docs/ideas/`.
84
- - The `record-idea` skill itself must unlearn the docs/ideas path.
85
-
86
- ## Validity check
87
- - Evidence we already have: `bd ready --exclude-label` and `bd ready -l` both exist and compose
88
- (label filtering + blocker-aware ready semantics) — the two core mechanisms this idea needs
89
- are native, no feature build. `--parent` exists for the hierarchy. 9-10 idea files exist to
90
- migrate; the record-idea skill and its script are the only two consumers of the file flow.
91
- - Riskiest assumption: that keeping ideas `open` (not `deferred`) + label exclusion is
92
- discoverable enough — ralph, plan agents, and the author must remember the exclusion. The
93
- `bd-tool` skill's labels table needs `kind:idea` documented with the exclusion convention.
94
- - What would invalidate this idea: if label-based exclusion leaks idea beads into `bd ready`
95
- via some path (e.g. `bd ready` without the exclude flag), or if losing the scannable
96
- `docs/ideas/` directory hurts occasional review more than bead queries help it.
97
-
98
- ## Constraints
99
- - Ideas stay quick to scan: `bd list -l kind:idea` + `bd show <id>` should be a comfortable
100
- replacement for opening the directory.
101
- - Idea beads must never appear in ralph's actionable-ready view.
102
- - `record-idea` and `bd-tool` skills stay consistent — no stale references to docs/ideas.
103
- - Priority of ideas uses the same P0-P4 scale as tasks (P4 = backlog default for ideas).
104
-
105
- ## Next validation step
106
- Prototype one idea as a labelled bead: create it with `-l kind:idea`, confirm `bd ready`
107
- excludes it by default and `bd ready -l kind:idea` surfaces it; then promote it (add epic label,
108
- spawn a child task) to confirm the hierarchy reads correctly. If the prototype passes, do the
109
- bulk migration + skill updates.
110
-
111
- ## Notes
112
- Interview on 2026-08-25 locked: labels over status (kind:idea + ralph exclusion), bead-only
113
- content (files deleted), parent-child promotion, and record-idea skill rewritten to create
114
- beads. Agent-nexus is the planned consumer. Once this lands, this very record becomes an
115
- idea-bead (and then this file is deleted — the migration eats its own tail).
@@ -1,72 +0,0 @@
1
- # Idea: self-flushing-session
2
-
3
- ## Status
4
- Backlog idea (not implementation-ready) — priority P1 (high)
5
-
6
- ## Created
7
- 2026-08-30
8
-
9
- ## Problem
10
- Sessions hold context far longer than needed. Every turn, tangent, and tool call stays in
11
- the window until a human notices the bloat and compacts or resets. The opposite of the
12
- current default: the agent should own its context lifecycle. It holds context *just long
13
- enough* to record the immediate outcome — as a bead — and then dumps everything, keeping
14
- only the bead ID. State is the enemy: no more than the immediately useful context is kept
15
- at any moment.
16
-
17
- ## Who benefits
18
- The author daily (token cost + focus — sessions never bloat, ever, regardless of how long
19
- the overall thread runs), and every future agent that must run long-lived threads. Beads
20
- become the entire memory surface: searchable, syncable, dependency-aware — no separate
21
- transcript or memory file to maintain.
22
-
23
- ## Proposed outcome
24
- A session model where:
25
- 1. **The agent decides when to flush.** No human noticing bloat and intervening — the agent
26
- watches for task completion and purges its own context.
27
- 2. **Hold just enough** to write the immediate outcome as a bead, then **dump all context,
28
- keeping the bead ID**. The ID is the only thing that survives the flush.
29
- 3. **Beads are the memories.** No separate memory store; the beads *are* the session memory.
30
- Progressively discovered — a fresh context pulls in relevant beads on demand (by ID/deps/
31
- labels) rather than exchanging the whole history every turn.
32
- 4. **A parent bead represents the session.** One session bead per conversation; the child
33
- memory beads (outcomes) hang under it, discovered progressively rather than loaded whole.
34
-
35
- Flush trigger to be fleshed out at design time: *"once a task is complete — that probably
36
- means a bead is written, but might not."* So: task completion is the event; bead-writing is
37
- the expected (but not guaranteed) artifact of it.
38
-
39
- ## Validity check
40
- - Evidence we already have: beads natively support parent/child hierarchy (`--parent`), labels,
41
- deps, search (`bd label`, `bd list`), and the ralph pipeline already treats beads as
42
- self-contained executable units. `task-session-context` (recorded 2026-08-25) establishes the
43
- "session is disposable, bead is the artifact" principle — this idea is the mechanism for it.
44
- - Riskiest assumption: an agent deciding to purge its *own* context is self-referential —
45
- mid-flush failures, deciding to dump while in-flight state matters, or dumping too early
46
- would lose work. Also: whether the harness (pi/Copilot CLI) exposes enough session-lifecycle
47
- control (start/stop/seed context, hard reset mid-thread) to make the flush mechanical rather
48
- than prompt-instructed.
49
- - What would invalidate this idea: if flush can't be made reliable as a mechanism (prompt-level
50
- "now clear your context" is fragile — the harness may not actually drop context), or if
51
- progressive discovery from beads proves lossy enough that flushed tasks mis-execute.
52
-
53
- ## Constraints
54
- - State minimisation is the point: keep only what the current task needs.
55
- - The bead ID is the only cross-flush pointer — everything else must be re-discoverable.
56
- - Must compose with existing loops: ralph stages, HITL handoffs, record-idea flow.
57
- - Extension vs agent is unresolved by design: an **extension** could mechanize flush + bead
58
- write via event hooks; an **agent** could own the session lifecycle and decide. Both recorded
59
- as candidate shapes — decide at design time.
60
-
61
- ## Next validation step
62
- Design-time fleshing-out: nail the flush trigger rules, the parent-session-bead structure,
63
- how a fresh context seeds itself (pull-by-ID vs pull-by-label), and whether pi/Copilot expose
64
- enough lifecycle control for a mechanical flush. Then a spike: one task completing → bead
65
- written → flush → fresh context re-seeding from the bead ID without losing the thread.
66
-
67
- ## Notes
68
- Recorded 2026-08-30 (P1, high). Cross-linked with `task-session-context` (principle) — this
69
- record is the sharper mechanism: autonomous flush, beads-as-memory (no separate store), parent
70
- session bead. Also adjacent to `pi-task-memory` (progressive discovery of memories) and
71
- `state-in-beads-not-md` (notes/state live in beads, not files) — the three records converge on
72
- "beads are the durable unit; context is a disposable implementation detail".