@jaybeeuu/agent-cortex 1.39.0 → 1.41.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.
- package/.agents/skills/style-versioning/SKILL.md +1 -1
- package/.github/workflows/ci.yml +47 -14
- package/AGENTS.md +35 -8
- package/CHANGELOG.md +60 -0
- package/README.md +174 -97
- package/agents/README.md +14 -11
- package/bin/agent-cortex.mjs +55 -10
- package/bin/installers/claude.mjs +674 -174
- package/bin/installers/copilot.mjs +13 -18
- package/bin/installers/pi.mjs +293 -51
- package/claude/settings.json +4 -0
- package/{claude → claude-extras}/scripts/statusline-command.sh +32 -4
- package/docs/claude-hooks.md +15 -3
- package/docs/ideas/ban-content-assertion-tests.md +73 -0
- package/docs/ideas/bead-progress-notes-for-session-resumption.md +75 -0
- package/docs/ideas/classify-beads-via-deterministic-script-with-agent-fallback.md +70 -0
- package/docs/ideas/ctx-alias-version-and-update-commands.md +65 -0
- package/docs/ideas/ctx-feedback-command-for-capturing-ideas-from-any-machine.md +67 -0
- package/docs/ideas/deployment-beads-for-post-merge-pipelines.md +36 -0
- package/docs/ideas/design-and-delivery-as-separate-bead-trees/design-and-delivery-as-separate-bead-trees.md +99 -0
- package/docs/ideas/enable-signed-commit-enforcement-changesets-bot-commits-must-be-signed.md +33 -0
- package/docs/ideas/extension-manifests.md +55 -14
- package/docs/ideas/improve-pi-system-prompt.md +5 -2
- package/docs/ideas/map-every-cortex-tool-to-a-real-pi-equivalent.md +95 -0
- package/docs/ideas/record-idea-implementation-questions.md +68 -0
- package/docs/ideas/self-flushing-session.md +72 -0
- package/docs/ideas/state-in-beads-not-md.md +69 -0
- package/docs/ideas/task-session-context.local.md +95 -0
- package/docs/ideas/test-data-creation-helpers.md +92 -0
- package/docs/ideas/test-planning-stage-bead-in-feature-planning.md +68 -0
- package/docs/ideas/worktree-housekeeping-for-closed-beads.md +39 -0
- package/docs/technical-direction/harness-config.md +161 -0
- package/docs/technical-direction/migration-execution-labels.md +60 -23
- package/extensions/agent-guardrails/README.md +45 -0
- package/extensions/agent-guardrails/guardrails.test.ts +42 -0
- package/extensions/agent-guardrails/guardrails.ts +66 -0
- package/extensions/agent-guardrails/index.ts +22 -0
- package/extensions/agent-guardrails/node_modules/.bin/pi +21 -0
- package/extensions/agent-guardrails/node_modules/.bin/tsc +21 -0
- package/extensions/agent-guardrails/node_modules/.bin/tsserver +21 -0
- package/extensions/agent-guardrails/node_modules/.bin/tsx +21 -0
- package/extensions/agent-guardrails/package.json +19 -0
- package/extensions/agent-guardrails/tsconfig.json +12 -0
- package/extensions/agent-modes/README.md +12 -5
- package/extensions/agent-modes/discover.test.ts +30 -7
- package/extensions/agent-modes/discover.ts +1 -1
- package/extensions/agent-modes/index.test.ts +208 -0
- package/extensions/agent-modes/index.ts +23 -6
- package/extensions/agent-modes/package.json +1 -1
- package/extensions/skill-stats/index.test.ts +3 -2
- package/lib/cli.mjs +30 -12
- package/lib/pi-packages.mjs +169 -0
- package/package.json +8 -4
- package/pi/settings.json +23 -12
- package/plugin.json +1 -1
- package/scripts/build-copilot-agents.mjs +1 -1
- package/scripts/check-no-sync.mjs +49 -0
- package/scripts/lib/compose-agent.mjs +32 -14
- package/scripts/lib/fs.mjs +31 -0
- package/skills/engineering/grill-with-docs/SKILL.md +1 -1
- package/skills/planning/classify-bead/REFERENCE.md +85 -0
- package/skills/planning/classify-bead/SKILL.md +32 -36
- package/skills/planning/classify-bead/scripts/classify-bead.mjs +292 -0
- package/skills/planning/create-task/SKILL.md +19 -10
- package/skills/planning/write-a-prd/SKILL.md +2 -2
- package/skills/style/style-code/REFERENCE.md +32 -2
- package/skills/style/style-code/SKILL.md +5 -21
- package/skills/style/style-tests/SKILL.md +69 -17
- package/skills/workflow/hitl-collab/SKILL.md +1 -1
- package/skills/workflow/run-pipeline-stage/SKILL.md +13 -1
- package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +12 -0
- package/test/classify-bead.test.mjs +277 -0
- package/test/claude-installer.test.mjs +199 -139
- package/test/cli.test.mjs +95 -41
- package/test/copilot-installer.test.mjs +92 -82
- package/test/fs.test.mjs +76 -0
- package/test/helpers/fake-claude.mjs +152 -0
- package/test/installer.test.mjs +542 -57
- package/test/pi-installer.test.mjs +457 -102
- package/test/pi-packages.test.mjs +295 -0
- package/token-map.README.md +23 -12
- package/token-map.json +8 -7
- package/.claude-plugin/marketplace.json +0 -16
- package/claude/.claude-plugin/plugin.json +0 -11
- package/claude/agents/plan.md +0 -58
- package/claude/agents/ralph-plan.md +0 -121
- package/claude/agents/ralph.md +0 -193
- package/claude/agents/strategy.md +0 -111
- package/claude/hooks/scripts/notify.mjs +0 -54
- package/claude/hooks.json +0 -38
- /package/{claude → claude-extras}/.mcp.json +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Idea: Improve PI System Prompt
|
|
2
2
|
|
|
3
3
|
## Status
|
|
4
|
-
Backlog idea (not implementation-ready)
|
|
4
|
+
Backlog idea (not implementation-ready) — first slice (circuit-breakers, check-in triggers,
|
|
5
|
+
atomic-change discipline) implemented as the `agent-guardrails` pi extension; the rest of the
|
|
6
|
+
idea is unscoped.
|
|
5
7
|
|
|
6
8
|
## Why it might be useful
|
|
7
9
|
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.
|
|
@@ -26,9 +28,10 @@ High — after current work lands. Directly impacts daily productivity and token
|
|
|
26
28
|
- Layer on top of PI's default prompt, or replace it entirely?
|
|
27
29
|
- Should PI's current system prompt be reviewed for nonsense that can be chopped out?
|
|
28
30
|
- 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)?
|
|
29
|
-
- How should circuit-breakers interact with skills like `run-pipeline-stage` that already have structured workflows?
|
|
30
31
|
|
|
31
32
|
## Notes
|
|
33
|
+
- **Precedence (settled by the first slice)**: the generic circuit-breakers yield to a structured
|
|
34
|
+
workflow — a skill or pipeline stage with its own explicit retry and check-in rules wins.
|
|
32
35
|
- **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.
|
|
33
36
|
- **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).
|
|
34
37
|
- **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.
|
|
@@ -0,0 +1,95 @@
|
|
|
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.
|
|
@@ -0,0 +1,68 @@
|
|
|
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.
|
|
@@ -0,0 +1,72 @@
|
|
|
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".
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Idea: state-in-beads-not-md
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Recorded as bead `agnt-ctx-ul91` (2026-09-22) — awaiting `plan`. Merged with
|
|
5
|
+
`bead-progress-notes-for-session-resumption.md` into one bead state model design (this file is
|
|
6
|
+
Part 1: WHERE state lives).
|
|
7
|
+
|
|
8
|
+
## Created
|
|
9
|
+
2026-08-30
|
|
10
|
+
|
|
11
|
+
## Problem
|
|
12
|
+
Skills write a lot of operational documents that are never meant to be committed or read
|
|
13
|
+
by humans at rest — they describe transient notes/current state. Today they land as md files:
|
|
14
|
+
- `hitl-collab` writes `.agent-cortex/working-docs/hitl/<bead-id>/handoff.md` — one file per
|
|
15
|
+
bead, near-duplicating information that already lives (or should live) on the bead.
|
|
16
|
+
- `run-pipeline-stage` / `ralph` write `.agent-cortex/ralph/ralph-{bead-id}.log` and
|
|
17
|
+
`.agent-cortex/ralph/progress.md` for live progress surfacing.
|
|
18
|
+
These files duplicate bead state, rot as the bead changes, and fragment context across
|
|
19
|
+
files + beads. They're also invisible to `bd` tooling (search, deps, sync).
|
|
20
|
+
|
|
21
|
+
## Who benefits
|
|
22
|
+
Every agent skill run that produces state (hitl-collab, ralph, run-pipeline-stage, plan,
|
|
23
|
+
and any future skill that takes notes). The author benefits from a single source of truth,
|
|
24
|
+
and ralph/pipeline state stops living in a `.agent-cortex` attic that drifts from the beads.
|
|
25
|
+
|
|
26
|
+
## Proposed outcome
|
|
27
|
+
A general rule stored in agent docs: **any artifact that is notes/current state — not
|
|
28
|
+
intended as committable durable documentation — lives in the bead's fields** (`--notes`,
|
|
29
|
+
`--context`, `--design`), not in md files.
|
|
30
|
+
- Durable, committable docs (SKILL.md, REFERENCE.md, playbooks/, prompts/, docs/) stay files.
|
|
31
|
+
- `hitl-collab` handoff: write the handoff content into the HITL bead (`--context`/`--notes`),
|
|
32
|
+
drop the `.agent-cortex/working-docs/hitl/<bead-id>/handoff.md` file flow.
|
|
33
|
+
- ralph progress/log lines: feed a live progress view off the beads (or a temp/log file kept
|
|
34
|
+
explicitly out of the `working-docs` convention) — spike details during planning.
|
|
35
|
+
- `record-idea`'s caveat: this same principle is what `record-ideas-as-beads` already applies
|
|
36
|
+
to idea records; this idea generalises it to operational/state artifacts.
|
|
37
|
+
|
|
38
|
+
## Validity check
|
|
39
|
+
- Evidence we already have: `bd` fields (`--notes`, `--context`, `--design`) support the content
|
|
40
|
+
model; `record-ideas-as-beads` already proves bead-field content is workable for structured
|
|
41
|
+
records (design decided 2026-08-25). Bead notes are multi-line and markdown-capable.
|
|
42
|
+
- Riskiest assumption: live progress surfacing (ralph's log tail / progress.md) can be
|
|
43
|
+
satisfied without a scratch file — the bead-update round-trip may be too slow/chatty for
|
|
44
|
+
high-frequency log lines; may need a per-run scratch log that is explicitly ephemeral and
|
|
45
|
+
deleted on close, rather than a persistent working doc.
|
|
46
|
+
- What would invalidate this idea: if bead fields become unwieldy for large attachments (e.g.
|
|
47
|
+
long PR summaries), or if a future agent needs shared state that must not be per-bead
|
|
48
|
+
(cross-bead coordination) — that's a different problem, not a per-bead note.
|
|
49
|
+
|
|
50
|
+
## Constraints
|
|
51
|
+
- Bead content is portable and searchable: `bd show <id>` must remain a comfortable read
|
|
52
|
+
surface for handoff/notes.
|
|
53
|
+
- Never regress committable docs into beads (AGENTS.md/skills stay in-repo markdown).
|
|
54
|
+
- P2 (medium): actively annoying today — hitl-collab handoff docs are already duplicating
|
|
55
|
+
bead state.
|
|
56
|
+
|
|
57
|
+
## Next validation step
|
|
58
|
+
Pick one skill (hitl-collab is the smallest, clearest case): prototype writing the handoff
|
|
59
|
+
into the bead's `--context` (or `--notes`) and read it back with `bd show`, confirm the
|
|
60
|
+
HITL reader (ralph/plan/handoff skill) can consume bead-stored handoffs; then extend the
|
|
61
|
+
rule to ralph progress with an ephemeral-scratch-log fallback if needed.
|
|
62
|
+
|
|
63
|
+
## Notes
|
|
64
|
+
Cross-link: sibling idea `record-ideas-as-beads` (fleshed out 2026-08-25) covers ideas
|
|
65
|
+
specifically — once it lands, docs/ideas/ disappears and this record becomes a bead too.
|
|
66
|
+
The rule here is the generalisation: beads are for state, files are for durable docs.
|
|
67
|
+
Skills that currently write working docs: `hitl-collab` (handoff.md), `ralph` +
|
|
68
|
+
`run-pipeline-stage` (ralph-*.log, progress.md). Update `bd-tool`/`git-workflow`/AGENTS.md
|
|
69
|
+
conventions if the rule lands.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Idea: task-session-context
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Backlog idea (not implementation-ready)
|
|
5
|
+
|
|
6
|
+
## Created
|
|
7
|
+
2026-08-25
|
|
8
|
+
|
|
9
|
+
## Problem
|
|
10
|
+
Coding sessions accumulate context turn by turn: every question, every tool call, every
|
|
11
|
+
tangent stays in the window until it's manually compacted or the session is restarted. Keeping
|
|
12
|
+
the context small and relevant is an active management burden — the author has to notice the
|
|
13
|
+
bloat, decide what matters, and intervene. Long conversations either burn tokens or require
|
|
14
|
+
frequent manual resets that drop useful memory.
|
|
15
|
+
|
|
16
|
+
## Who benefits
|
|
17
|
+
The author, daily. Removing context management from the loop means sessions stay small and
|
|
18
|
+
focused no matter how long the overall thread runs. It also produces a durable, reviewable log
|
|
19
|
+
of work: each task's bead + summary memory is an audit trail of what was done and why.
|
|
20
|
+
|
|
21
|
+
## Proposed outcome
|
|
22
|
+
A workflow organised around **tasks** instead of sessions. Whenever the user does something
|
|
23
|
+
discrete — asks a new question, records an idea, fleshes out a piece of work — it **begins a
|
|
24
|
+
task**:
|
|
25
|
+
|
|
26
|
+
1. **Task = blank session with memory context.** The task starts a fresh, self-contained
|
|
27
|
+
session. It does NOT get every turn and tool call of the parent conversation — only access
|
|
28
|
+
to the accumulated **memories** of what came before (a summary/compressed view, not the raw
|
|
29
|
+
transcript).
|
|
30
|
+
2. **Self-contained execution.** The task works on its own: it takes action, and **records
|
|
31
|
+
memories along the way** as it produces outcomes.
|
|
32
|
+
3. **Single summary memory on completion.** The last thing a task does is write one summary
|
|
33
|
+
memory capturing its outcome. These memories are additive — the running memory store grows as
|
|
34
|
+
tasks complete.
|
|
35
|
+
4. **Fresh session continues the thread.** Once the task completes, a new session starts with
|
|
36
|
+
access to the memories — including the new summary — so to the user it feels like one
|
|
37
|
+
continuous thread, but each underlying session stays small.
|
|
38
|
+
|
|
39
|
+
**Ties into beads (bd):** "the completion of a bead is the completion of a task". A bead becomes
|
|
40
|
+
the log of work completed: the task's outcome is recorded on/with the bead, the fresh session
|
|
41
|
+
starts, and the bead is accompanied by **referential memory** (a pointer/memory entry that links
|
|
42
|
+
the outcome to the bead). So the bead doubles as the durable record AND the context-boundary
|
|
43
|
+
marker: starting a bead is the trigger for task-session separation.
|
|
44
|
+
|
|
45
|
+
**The bead is the artifact — the session is disposable.** Once a task is complete, the whole
|
|
46
|
+
conversation context is no longer needed; the bead is the artifact. The current conversation is
|
|
47
|
+
the live example: recording this idea is a task, and when it's done the transcript of every turn
|
|
48
|
+
and tool call can be discarded — what remains is the record plus its summary/referential memory.
|
|
49
|
+
This is the load-bearing philosophical point of the idea: sessions exist to serve tasks, not the
|
|
50
|
+
other way around. Context is an implementation detail of a single task; the bead is the durable
|
|
51
|
+
unit of history.
|
|
52
|
+
|
|
53
|
+
The mechanism likely needs: a memory store (per-project, e.g. under `~/.pi/agent-cortex/` or a
|
|
54
|
+
records convention), a session-scoping rule (what memories a fresh task session is seeded with),
|
|
55
|
+
the summary-writing step, and the bead ↔ memory linkage.
|
|
56
|
+
|
|
57
|
+
## Validity check
|
|
58
|
+
- Evidence we already have: the repo already runs on beads as the unit of work (bd), and the
|
|
59
|
+
ralph pipeline already treats beads as self-contained executable units — so task-per-bead
|
|
60
|
+
separation is a natural extension of an existing pattern. Existing ideas
|
|
61
|
+
(`record-ideas-as-beads`, `pi-task-memory`, `extension-manifests`) all push in the direction of
|
|
62
|
+
making agent-cortex the declared, memory-rich source of truth.
|
|
63
|
+
- Riskiest assumption: that a fresh session seeded with *memories only* (no raw transcript) is
|
|
64
|
+
sufficient context for a task — the compression of a conversation into memories must not lose
|
|
65
|
+
the specifics a task needs. Also: whether the harness (pi/Claude) even supports programmatic
|
|
66
|
+
session spawning with a seed context cleanly enough for this to feel seamless.
|
|
67
|
+
- What would invalidate this idea: if memory-as-context proves lossy in a way that keeps tasks
|
|
68
|
+
mis-executing (then the blank-session model needs the raw transcript after all, defeating the
|
|
69
|
+
point); or if the session boundary machinery (start/stop/spawn with seed) fights the harness.
|
|
70
|
+
|
|
71
|
+
## Constraints
|
|
72
|
+
- Sessions must stay small — this is the whole point; memory is the interface, not the transcript.
|
|
73
|
+
- Memories are additive and durable; the summary memory is the handoff contract between tasks.
|
|
74
|
+
- The bead is the work log AND the context boundary: no task completion without its summary
|
|
75
|
+
memory and bead record.
|
|
76
|
+
- Must not break the existing task loops (ralph pipeline stages, HITL handoffs) — it should
|
|
77
|
+
compose with them, not fork them.
|
|
78
|
+
|
|
79
|
+
## Next validation step
|
|
80
|
+
Flesh-out session (proposed by the author): nail down the trigger rules (what counts as "begin a
|
|
81
|
+
task"), the memory store schema and what a "memory" is vs a summary, how a fresh session gets
|
|
82
|
+
seeded, and how the bead carries the summary + referential memory. Then a spike: one task
|
|
83
|
+
completing with summary → fresh session seeded → verify the thread feels continuous.
|
|
84
|
+
|
|
85
|
+
## Notes
|
|
86
|
+
Recorded 2026-08-25. The author explicitly wants to flesh this out later — this record captures
|
|
87
|
+
the working concept. It connects several existing ideas: `record-ideas-as-beads` (beads as the
|
|
88
|
+
unit of everything), `pi-task-memory` (memory as a first-class mechanism), and
|
|
89
|
+
`subagent-visibility` (visibility into what task sessions do).
|
|
90
|
+
|
|
91
|
+
**Amendment (2026-08-30):** see `self-flushing-session` — the sharper mechanism record for this
|
|
92
|
+
principle: agent autonomously decides when to flush, beads *are* the memory store (no separate
|
|
93
|
+
system), a parent session bead holds the conversation with child outcome beads discovered
|
|
94
|
+
progressively, and the bead ID is the only thing kept across a flush. This record remains the
|
|
95
|
+
principle; `self-flushing-session` is the mechanism.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Idea: Test data creation helpers
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Backlog idea (not implementation-ready) — priority P2 (moderate)
|
|
5
|
+
|
|
6
|
+
## Created
|
|
7
|
+
2026-09-14
|
|
8
|
+
|
|
9
|
+
## Problem
|
|
10
|
+
Agents writing tests reach for test data the lazy way, in three shapes:
|
|
11
|
+
|
|
12
|
+
1. **Shared module-scope objects used as fixtures.** Because the object is built once at
|
|
13
|
+
top-level scope and reused, every test mutates the same instance — state leaks between
|
|
14
|
+
tests, and a passing test can depend on the order in which others ran. Failures are
|
|
15
|
+
order-dependent and hard to reproduce in isolation.
|
|
16
|
+
2. **Data built outside the test rather than inline.** The reader — and the next agent — must
|
|
17
|
+
scroll away from the assertion to find what the input actually was, so the test stops
|
|
18
|
+
reading as an example of the behaviour under test.
|
|
19
|
+
3. **No small configurable helper.** Instead of a factory with sensible defaults and an
|
|
20
|
+
overrides argument, each test re-spells the entire literal. One field change means editing
|
|
21
|
+
every call site, and the tests silently drift apart from one another.
|
|
22
|
+
|
|
23
|
+
Net effect: tests that are annoying to read, annoying to change, and occasionally lie. The
|
|
24
|
+
cost is paid again on every subsequent edit.
|
|
25
|
+
|
|
26
|
+
## Who benefits
|
|
27
|
+
Everyone who reads or changes the suite: the author reviewing a diff, the reviewer agent
|
|
28
|
+
auditing a PR, and later agents picking the code up cold. It also cuts churn in ralph pipeline
|
|
29
|
+
runs, where agents write tests unattended and nobody corrects a sloppy fixture habit in the
|
|
30
|
+
moment. Test authors write less boilerplate; reviewers have less to query.
|
|
31
|
+
|
|
32
|
+
## Proposed outcome
|
|
33
|
+
Skill-only guidance (no shipped helper code) telling the agent how to create test data:
|
|
34
|
+
|
|
35
|
+
- **Build data inline in the test** (or in a helper called from it), so the test body shows the
|
|
36
|
+
shape of its own input.
|
|
37
|
+
- **No shared mutable top-level fixture.** If data must be reused, it is produced fresh per
|
|
38
|
+
test by a function — a factory, not a constant. Module-scope constants are acceptable only
|
|
39
|
+
when genuinely immutable and read-only.
|
|
40
|
+
- **Prefer a small configurable helper** — a factory taking partial overrides with defaults for
|
|
41
|
+
the rest — over repeated full literals. Build the helper only when reuse justifies it; a
|
|
42
|
+
single test's data stays a plain inline object.
|
|
43
|
+
- **Name and locate the helper conventionally** so the next agent finds it (colocated with the
|
|
44
|
+
tests, named for what it builds).
|
|
45
|
+
|
|
46
|
+
Landing: the rule belongs in `style-tests`, the skill that already governs test-writing
|
|
47
|
+
conventions, with `tdd` and `engineering` pointing at it so the habit lands at authoring time.
|
|
48
|
+
Per the repo's keep-skill-bodies-small convention it is a red-flag row plus a checklist item,
|
|
49
|
+
not a new essay.
|
|
50
|
+
|
|
51
|
+
## Validity check
|
|
52
|
+
- Evidence we already have: the pattern is observed repeatedly in agent-authored tests
|
|
53
|
+
(module-scope fixtures mutated across tests, full literals duplicated per test); `style-tests`
|
|
54
|
+
already asserts behaviour-over-structure and mock discipline, so a data-construction rule fits
|
|
55
|
+
its existing remit without new philosophy; and the sibling idea `ban-content-assertion-tests`
|
|
56
|
+
shows this class of test-quality gap is real and gets fixed the same way — skill-only, red flag
|
|
57
|
+
plus checklist item. The repo already ships skills governing how tests are written, so there is
|
|
58
|
+
a known enforcement point and no new mechanism to invent.
|
|
59
|
+
- Riskiest assumption: that a prose rule actually changes agent behaviour. The content-assertion
|
|
60
|
+
idea rests on the same assumption; if agents keep reaching for module-scope fixtures after the
|
|
61
|
+
rule lands, the fix is a review gate rather than more wording. Second-riskiest: that "no shared
|
|
62
|
+
top-level fixture" is not overly absolute — a genuinely immutable shared constant (a frozen
|
|
63
|
+
canonical example) is fine, so the wording must target mutability and per-test freshness, not
|
|
64
|
+
top-level scope by itself.
|
|
65
|
+
- What would invalidate this idea: finding that the real cause is not agent habit but a missing
|
|
66
|
+
convention in the target projects (nowhere for a helper to live, so inline literals are the only
|
|
67
|
+
option), or that a project's test framework already ships builders the agent simply fails to
|
|
68
|
+
find — either would move the fix to discoverability or enforcement rather than a style rule.
|
|
69
|
+
|
|
70
|
+
## Constraints
|
|
71
|
+
- **Skill-only.** No helper library shipped from this plugin — each project owns its factories.
|
|
72
|
+
- Keep `style-tests` at ~100 lines: add a red-flag row and a verification-checklist item; do not
|
|
73
|
+
expand the skill's philosophy.
|
|
74
|
+
- Do not ban top-level constants outright — the rule targets mutable shared state and per-test
|
|
75
|
+
freshness.
|
|
76
|
+
- Small scope: no pipeline changes beyond pointing `tdd`/`engineering` at the rule.
|
|
77
|
+
|
|
78
|
+
## Next validation step
|
|
79
|
+
Before implementing, grep the agent-authored tests in this repo (and one or two target projects)
|
|
80
|
+
for module-scope fixture objects versus inline/per-test construction, to confirm the pattern is as
|
|
81
|
+
frequent as the anecdote suggests and to capture two or three concrete before/after examples. If
|
|
82
|
+
it is real, land the red-flag row in `style-tests`, add the pointer lines in `tdd`/`engineering`,
|
|
83
|
+
then check the next ralph run's tests for it.
|
|
84
|
+
|
|
85
|
+
## Notes
|
|
86
|
+
Recorded 2026-09-14 (P2). Interview was deliberately short — this is a capture, not a spec. Timing
|
|
87
|
+
signal: "it's annoying" — a recurring, low-severity papercut that costs a little on every test
|
|
88
|
+
edit rather than a project-breaking defect, hence P2 rather than the P1 carried by adjacent
|
|
89
|
+
content-assertion work. Stance locked in interview: skill-only guidance, no shipped helper code;
|
|
90
|
+
the fix is teaching the agent the pattern, not providing a library. Related:
|
|
91
|
+
`ban-content-assertion-tests.md` (same enforcement point, same shape of fix),
|
|
92
|
+
`test-planning-stage-bead-in-feature-planning.md` (test-stage quality in the pipeline).
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Idea: Test-planning stage bead in feature planning
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Absorbed into bead `agnt-ctx-rig0` (2026-09-22) — the verification beads in that design's
|
|
5
|
+
design stage generalise this idea's provable-outcome / completion-criterion motivation. Not a
|
|
6
|
+
standalone bead.
|
|
7
|
+
|
|
8
|
+
## Created
|
|
9
|
+
2026-09-03
|
|
10
|
+
|
|
11
|
+
## Problem
|
|
12
|
+
Tests get under-planned: features are split into beads around implementation
|
|
13
|
+
(code, verify, review) but nobody plans *what* needs testing or *how we know
|
|
14
|
+
it's done* before the work starts. Verification ends up ad hoc — a verify
|
|
15
|
+
stage runs whatever tests exist rather than the tests the feature actually
|
|
16
|
+
needs.
|
|
17
|
+
|
|
18
|
+
## Who benefits
|
|
19
|
+
- The agent running the pipeline (ralph / run-pipeline-stage) — has an explicit
|
|
20
|
+
test plan to execute against instead of improvising a verify pass.
|
|
21
|
+
- The human reviewer — a stated definition of done for testing makes the PR
|
|
22
|
+
gate checkable ("did the planned tests land?").
|
|
23
|
+
- The feature itself — testability becomes a planning output, not an accident.
|
|
24
|
+
|
|
25
|
+
## Proposed outcome
|
|
26
|
+
When a feature is planned, the planning phase also produces a
|
|
27
|
+
test/verification planning stage bead: what behaviour to test, at what level
|
|
28
|
+
(unit/integration/e2e), key cases and edge cases, and an explicit completion
|
|
29
|
+
criterion — the answer to "how do we know it's done?" The bead sits between
|
|
30
|
+
feature planning and implementation, so test planning happens once at plan
|
|
31
|
+
time rather than being rediscovered per-task.
|
|
32
|
+
|
|
33
|
+
## Validity check
|
|
34
|
+
- Evidence we already have: verify-stage chores exist today but run generic
|
|
35
|
+
checks (`playbooks/verify.md`, `run-pipeline-stage`); nothing at plan time
|
|
36
|
+
defines the feature's test surface or a testing definition of done — PR
|
|
37
|
+
reviews have to reconstruct what should have been tested.
|
|
38
|
+
- Riskiest assumption: a test-plan bead is actually useful to the executing
|
|
39
|
+
agent and isn't just ceremony that duplicates what the code bead already
|
|
40
|
+
implies ("write tests that cover this feature"). Cheap to validate: try it
|
|
41
|
+
on one feature and judge whether the verify stage runs a materially better
|
|
42
|
+
test pass.
|
|
43
|
+
- What would invalidate this idea: if RALPH's verify stage already produces
|
|
44
|
+
adequate coverage decisions from the playbook alone, the extra bead adds
|
|
45
|
+
overhead without changing outcomes.
|
|
46
|
+
|
|
47
|
+
## Constraints
|
|
48
|
+
- Pipeline shape is fixed by the existing bead/pipeline contract
|
|
49
|
+
(create-task chores, ralph stage dispatch) — the new bead type must slot in
|
|
50
|
+
without a pipeline redesign.
|
|
51
|
+
- No new runtime for test execution — the bead plans; existing verify tooling
|
|
52
|
+
executes.
|
|
53
|
+
- Must stay lightweight: test planning for its own sake is the failure mode.
|
|
54
|
+
|
|
55
|
+
## Next validation step
|
|
56
|
+
Run a two-feature pilot: for the next two planned features, hand-write a
|
|
57
|
+
test/verification plan bead (without wiring it into the pipeline) and compare
|
|
58
|
+
the resulting verify passes against a control feature planned the current
|
|
59
|
+
way. If the planned features demonstrably get better test coverage, wire the
|
|
60
|
+
bead type into the planning skill.
|
|
61
|
+
|
|
62
|
+
## Notes
|
|
63
|
+
- User framing: "planning, then test/verification planning — how do we know
|
|
64
|
+
it's done?" The completion criterion is the heart of the idea, not the bead
|
|
65
|
+
itself.
|
|
66
|
+
- Priority: medium — next planning-skill iteration, not blocking current work.
|
|
67
|
+
- The definition-of-done answer could eventually feed the HITL PR gate
|
|
68
|
+
(reviewer checks planned-tests-vs-landed-tests).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Idea: Worktree housekeeping for closed beads
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Backlog idea (not implementation-ready)
|
|
5
|
+
|
|
6
|
+
## Created
|
|
7
|
+
2026-09-13
|
|
8
|
+
|
|
9
|
+
## Problem
|
|
10
|
+
Ralph runs each bead in a dedicated worktree under `.agent-cortex/worktrees/<parent-id>` and only cleans up when a human manually removes it — the `git-workflow` skill's "Worktree lifecycle" step is discretionary, not enforced. Closed, merged beads leave their worktrees behind, and crashed or abandoned runs leave orphaned ones. The worktree set drifts from the actual bead/PR state with no mechanism to converge it.
|
|
11
|
+
|
|
12
|
+
## Who benefits
|
|
13
|
+
- The author, who currently accumulates stale worktrees and must identify and remove them by hand.
|
|
14
|
+
- Future ralph/agent sessions, which skip reading a worktree set polluted by dead state and avoid accidentally reusing an abandoned worktree for a new bead.
|
|
15
|
+
- Confident teardown: knowing a merged feature's worktree is gone makes "is this still live?" checks unnecessary.
|
|
16
|
+
|
|
17
|
+
## Proposed outcome
|
|
18
|
+
Two tiers of cleanup:
|
|
19
|
+
- **Minor (deterministic)**: when a ralph run's PRs merge and its beads close, the associated worktrees are removed as part of the close-off — no LLM judgement needed.
|
|
20
|
+
- **Major (broader)**: a reusable housekeeping pass that finds and reports orphaned or abandoned worktrees (no corresponding live bead, no open PR / stale branch), usable on demand.
|
|
21
|
+
|
|
22
|
+
Cleanup is safe-first: it must not remove a worktree whose branch or bead is still active, and unmerged/abandoned worktrees should be surfaced rather than silently deleted.
|
|
23
|
+
|
|
24
|
+
## Validity check
|
|
25
|
+
- Evidence we already have: `git-workflow` SKILL.md already documents "after the PR is merged or closed, clean up the worktree" as a manual step — the intent exists, only the enforcement is missing. Ralph already knows the full mapping of bead → worktree → PR, so it has all the data a deterministic cleanup needs.
|
|
26
|
+
- Riskiest assumption: worktree state can be derived reliably from bead state + git state (that a "closed bead" always means its worktree is safe to remove, and that orphan detection can distinguish abandoned worktrees from merely idle ones). If the bead/PR mapping is lossy — e.g. beads close without recording whether the PR merged — the deterministic rule could remove an unmerged feature's worktree.
|
|
27
|
+
- What would invalidate this idea: if the cost of a false positive cleanup (losing an unmerged feature's worktree or its local branches) outweighs the cost of the current manual drift; or if ralph's lifecycle already converges worktrees in practice and the observed accumulation is negligible.
|
|
28
|
+
|
|
29
|
+
## Constraints
|
|
30
|
+
- Human merge gates stay non-negotiable — cleanup must never imply or require auto-merging.
|
|
31
|
+
- No destructive action on anything the mapping can't positively classify (unmerged features, active beads, open PRs) — default to reporting.
|
|
32
|
+
- Both the skill and the deterministic script live in this repo (`skills/`, `scripts/`); final split between skill, script, or both is a design-time decision.
|
|
33
|
+
|
|
34
|
+
## Next validation step
|
|
35
|
+
List worktrees across a few real (recently completed) ralph sessions and compare against bead/PR state to measure actual accumulation and test whether closed-bead → safe-to-remove always holds. This both quantifies the problem and de-risks the riskiest assumption.
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
- Interview left two design-time decisions open: (1) whether cleanup lives as a skill, a script, or both; (2) whether it runs at session start, inside the ralph loop, or as an on-demand command — "maybe both" was the lean.
|
|
39
|
+
- Related backlog neighbours worth reconciling when this is planned: `deployment-beads-for-post-merge-pipelines.md` (post-merge lifecycle), `record-ideas-as-beads.md` if the major housekeeping pass becomes a scheduled bead.
|