@jaybeeuu/agent-cortex 1.38.1 → 1.39.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.md +3 -1
- package/CHANGELOG.md +30 -0
- package/README.md +34 -16
- package/agents/README.md +7 -5
- package/agents/ralph-plan/agent.md +1 -1
- package/agents/ralph-plan.agent.md +1 -1
- package/bin/agent-cortex.mjs +13 -5
- package/bin/installers/claude.mjs +129 -15
- package/claude/.claude-plugin/plugin.json +1 -1
- package/claude/agents/ralph-plan.md +1 -1
- package/docs/ideas/extension-manifests.md +75 -0
- package/docs/ideas/record-ideas-as-beads.md +115 -0
- package/docs/ideas/subagent-visibility.md +72 -0
- package/docs/ideas/task-session-context.md +89 -0
- package/docs/research/skill-design-research.md +4 -4
- package/docs/research/skill-improvements-analysis.md +1 -1
- package/docs/skills/skill-anatomy.md +38 -2
- package/docs/technical-direction/migration-execution-labels.md +132 -0
- package/lib/cli.mjs +9 -3
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/pnpm-workspace.yaml +1 -1
- package/skills/engineering/design-an-interface/SKILL.md +78 -58
- package/skills/engineering/grill-with-docs/REFERENCE.md +78 -0
- package/skills/engineering/grill-with-docs/SKILL.md +66 -63
- package/skills/engineering/improve-codebase-architecture/SKILL.md +66 -48
- package/skills/engineering/technical-direction/FORMAT.md +38 -0
- package/skills/engineering/technical-direction/SKILL.md +70 -77
- package/skills/planning/classify-bead/SKILL.md +59 -35
- package/skills/planning/create-task/REFERENCE.md +40 -0
- package/skills/planning/create-task/SKILL.md +70 -66
- package/skills/planning/create-task/scripts/create-chores.ts +6 -1
- package/skills/planning/create-task/scripts/node_modules/.bin/tsc +21 -0
- package/skills/planning/create-task/scripts/node_modules/.bin/tsserver +21 -0
- package/skills/planning/create-task/scripts/node_modules/.bin/tsx +21 -0
- package/skills/planning/prd-to-tasks/REFERENCE.md +66 -0
- package/skills/planning/prd-to-tasks/SKILL.md +86 -170
- package/skills/planning/record-idea/FORMAT.md +44 -0
- package/skills/planning/record-idea/SKILL.md +70 -53
- package/skills/planning/request-refactor-plan/FORMAT.md +45 -0
- package/skills/planning/request-refactor-plan/SKILL.md +57 -46
- package/skills/planning/write-a-prd/FORMAT.md +54 -0
- package/skills/planning/write-a-prd/SKILL.md +49 -48
- package/skills/planning/write-a-ticket/SKILL.md +68 -53
- package/skills/productivity/handoff/SKILL.md +12 -0
- package/skills/productivity/init-beads/SKILL.md +48 -40
- package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsc +21 -0
- package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsserver +21 -0
- package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsx +21 -0
- package/skills/productivity/write-a-skill/SKILL.md +2 -1
- package/skills/review/maintain-agent-docs/SKILL.md +71 -51
- package/skills/workflow/hitl-collab/SKILL.md +86 -17
- package/skills/workflow/ralph/REFERENCE.md +22 -17
- package/skills/workflow/ralph/SKILL.md +88 -74
- package/skills/workflow/run-pipeline-stage/REFERENCE.md +22 -0
- package/skills/workflow/run-pipeline-stage/SKILL.md +91 -93
- package/skills/workflow/run-pipeline-stage/scripts/generate-progress.test.ts +6 -107
- package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsc +21 -0
- package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsserver +21 -0
- package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsx +21 -0
- package/test/claude-installer.test.mjs +248 -0
- package/token-map.README.md +5 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Idea: subagent-visibility
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Backlog idea (not implementation-ready)
|
|
5
|
+
|
|
6
|
+
## Created
|
|
7
|
+
2026-08-25
|
|
8
|
+
|
|
9
|
+
## Problem
|
|
10
|
+
The bundled `subagent` extension delegates work to separate `pi` processes with isolated
|
|
11
|
+
context windows. It streams output live, shows per-agent usage stats (turns, tokens, cost), and
|
|
12
|
+
supports abort — but after a run there's no retained record of what each subagent actually did
|
|
13
|
+
(files touched, decisions, blockers), and while a run is in flight there's no richer
|
|
14
|
+
dashboard-level view of what each agent is up to. There's also no way to influence a running
|
|
15
|
+
subagent: you can only watch or Ctrl+C the whole thing. For the ralph-style parallel dispatches
|
|
16
|
+
(up to 5 concurrent chores) this is a real blind spot.
|
|
17
|
+
|
|
18
|
+
## Who benefits
|
|
19
|
+
The author, whenever running parallel subagent work (ralph pipeline chores, parallel research).
|
|
20
|
+
A live dashboard helps during runs; persisted per-run reports turn subagent work into a
|
|
21
|
+
reviewable after-action record (which also complements the HITL/summary flow). Mid-run steering
|
|
22
|
+
reduces wasted tokens from subagents heading the wrong way and having to restart.
|
|
23
|
+
|
|
24
|
+
## Proposed outcome
|
|
25
|
+
Expand (or adopt, if a store extension fits) subagent tooling to give:
|
|
26
|
+
|
|
27
|
+
1. **Live dashboard** — richer TUI during runs: per-agent status (phase, current tool call,
|
|
28
|
+
files touched), so you can see what each parallel subagent is doing without digging into
|
|
29
|
+
streamed output.
|
|
30
|
+
2. **Persisted reports** — a per-run record per subagent (what it did, files changed,
|
|
31
|
+
decisions, blockers), stored for after-action review. Persistence should follow the repo
|
|
32
|
+
convention: write to `~/.pi/agent-cortex/`, tagged with project path for per-project slicing.
|
|
33
|
+
3. **Mid-run steering** — send a message to a running subagent to change its direction
|
|
34
|
+
("skip that, focus on X") rather than killing and restarting.
|
|
35
|
+
|
|
36
|
+
Decision from the interview: **evaluate the pi extension store first** — if a maintained
|
|
37
|
+
extension already covers dashboard + reports (and ideally steering), adopt it; otherwise expand
|
|
38
|
+
the bundled `subagent` extension. Building is a fallback, not the default.
|
|
39
|
+
|
|
40
|
+
## Validity check
|
|
41
|
+
- Evidence we already have: the bundled `subagent` extension is a working base — it already
|
|
42
|
+
spawns `pi` subprocesses, streams, and collects usage data, so the hooks for a dashboard and
|
|
43
|
+
reports exist in some form. The repo has a data convention (`~/.pi/agent-cortex/`, per-project
|
|
44
|
+
tagging) that reports would slot into.
|
|
45
|
+
- Riskiest assumption: that mid-run steering is technically feasible — subagents run as separate
|
|
46
|
+
`pi` processes, so steering likely needs a message channel (e.g. a FIFO / IPC pipe into the
|
|
47
|
+
running process, or a PI-native way to inject input). If the process model doesn't allow input
|
|
48
|
+
mid-run, the interaction half collapses to "abort and re-dispatch with corrected instruction".
|
|
49
|
+
- What would invalidate this idea: if store extensions are all visibility-only (no steering) and
|
|
50
|
+
the process model rules out mid-run input, the remaining value is dashboard + reports only.
|
|
51
|
+
Also, if subagents use private pipes that block reading live state cheaply, the dashboard may
|
|
52
|
+
be constrained to what the streamer already shows.
|
|
53
|
+
|
|
54
|
+
## Constraints
|
|
55
|
+
- Keep it lightweight and consistent with the repo's extension conventions (no internal LLM
|
|
56
|
+
calls in the extension itself).
|
|
57
|
+
- Should compose with ralph's parallel dispatch (up to 5 concurrent chores) without making the
|
|
58
|
+
TUI unusable.
|
|
59
|
+
- Steering must be safe: a message is advisory input to the subagent, not a force-kill;
|
|
60
|
+
abort stays available.
|
|
61
|
+
|
|
62
|
+
## Next validation step
|
|
63
|
+
Two-part check before building: (1) search the pi extension store for subagent/dashboard/steering
|
|
64
|
+
extensions and evaluate against this wishlist; (2) verify whether a running `pi` subagent
|
|
65
|
+
process accepts input mid-run (checked against how the subagent extension spawns processes and
|
|
66
|
+
whether PI exposes any IPC/input channel) — this decides whether steering is scoped in.
|
|
67
|
+
|
|
68
|
+
## Notes
|
|
69
|
+
Recorded 2026-08-25. Interview decisions: visibility = both live dashboard AND persisted
|
|
70
|
+
per-run reports; interaction = mid-run steering (not approve-gates, not pause/resume); path =
|
|
71
|
+
evaluate store first, fall back to expanding the bundled `subagent` extension. Complements
|
|
72
|
+
`unified-ci-pipeline` (pipeline visibility) and the ralph parallelism work in this repo.
|
|
@@ -0,0 +1,89 @@
|
|
|
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).
|
|
@@ -58,9 +58,9 @@ Both repos follow the same two-part format: capability sentence + `"Use when..."
|
|
|
58
58
|
> "Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says 'diagnose this' / 'debug this', reports a bug, says something is broken/throwing/failing, or describes a performance regression."
|
|
59
59
|
|
|
60
60
|
**agent-cortex example** (vaguer triggers):
|
|
61
|
-
> "Create a bead, classify it, and if AFK expand it into pipeline stage
|
|
61
|
+
> "Create a task bead, classify it as AFK or HITL, and if AFK expand it into pipeline stage chores plus a HITL PR gate. Use when starting tracked work with implementation and review gates — 'create a task for this', 'track this end-to-end', or 'get this into the ralph pipeline'."
|
|
62
62
|
|
|
63
|
-
The agent-cortex description
|
|
63
|
+
The agent-cortex description leads with internal mechanics ("task bead", "AFK", "HITL") rather than what the user is trying to accomplish — the quoted triggers were added in a later refactor, but the jargon remains.
|
|
64
64
|
|
|
65
65
|
---
|
|
66
66
|
|
|
@@ -180,7 +180,7 @@ Move to Phase 2 only when both boxes are checked.
|
|
|
180
180
|
|
|
181
181
|
**Evidence**: Anthropic Building Effective Agents: *"Think of this as writing a great docstring for a junior developer on your team."* For agents, descriptions are the only routing signal. FLAN (Wei et al., ICLR 2022) showed instruction-tuned models generalise from natural language task descriptions — use the vocabulary a user would *actually speak*, not internal system jargon. Anthropic tool use note: `"Use when"` language *actively counteracts* the model's default tendency to solve problems without invoking tools.
|
|
182
182
|
|
|
183
|
-
**Current state**: some agent-cortex descriptions describe internal mechanics rather than user intent. E.g., `create-task`: *"Use when
|
|
183
|
+
**Current state**: some agent-cortex descriptions describe internal mechanics rather than user intent. E.g., `create-task`: *"Use when starting tracked work with implementation and review gates — 'create a task for this', 'track this end-to-end', or 'get this into the ralph pipeline'."* — rewritten to add quoted user triggers (per this rec), though it still leans on internal jargon like "ralph pipeline" a user wouldn't say.
|
|
184
184
|
|
|
185
185
|
**Recommendation**: Rewrite descriptions to lead with user-vocabulary triggers. Include 2–4 quoted phrases or scenario patterns a user might say:
|
|
186
186
|
|
|
@@ -219,7 +219,7 @@ argument-hint: "Describe the bug or paste the error message"
|
|
|
219
219
|
|
|
220
220
|
### Rec 10 — Fix prd-to-epics Missing SKILL.md
|
|
221
221
|
|
|
222
|
-
**Current state**: `skills/prd-to-epics/` directory
|
|
222
|
+
**Current state**: Resolved in #16 — the broken `skills/prd-to-epics/` directory was removed; epic/task decomposition is consolidated into the `prd-to-tasks` skill (see CHANGELOG 1.0.0).
|
|
223
223
|
|
|
224
224
|
**Recommendation**: Either write the missing `SKILL.md` or remove the directory. This is a straightforward bug.
|
|
225
225
|
|
|
@@ -110,7 +110,7 @@ REFERENCE.md" — keeping SKILL.md as the primary working document rather than g
|
|
|
110
110
|
| Verification checklists | Planned |
|
|
111
111
|
| Concrete examples | Planned |
|
|
112
112
|
| Reconsider 100-line limit | Done (raised to 150) |
|
|
113
|
-
| ASCII workflow diagrams |
|
|
113
|
+
| ASCII workflow diagrams | Done (ASCII-only style guide in skill-anatomy.md) |
|
|
114
114
|
| Cross-references between skills | Planned |
|
|
115
115
|
| Consistent skeleton template | Partially adopted |
|
|
116
116
|
|
|
@@ -57,6 +57,23 @@ For each optional section, define **what it is**, include an **example snippet**
|
|
|
57
57
|
| `Phase-gate checklists` | Mid-workflow gates that must pass before proceeding | `- [ ] Phase 1 complete: baseline tests captured.` | Multi-phase workflows (3+ distinct phases) | Linear single-phase tasks |
|
|
58
58
|
| `Cross-skill references` | Explicit delegation to another skill for a real sub-task | `- Run \\`review-security\\` before committing.` | Another skill owns a sub-domain better than restating it | Self-contained skills |
|
|
59
59
|
| `Examples` | Full worked sample of expected outcome/output | `- Input: ... Output: ...` | Any non-trivial output contract | Trivially self-evident skills |
|
|
60
|
+
| `Workflow diagrams` | Inline ASCII diagram showing step flow and decision points | Fenced block of `[Box]`, `|`, `-`, `>`, `v` arrows, e.g. `[Start] --> [Validate] --> [Run]` | Multi-step or branching workflows where a glanceable flow improves comprehension | Simple linear workflows already clear from numbered steps |
|
|
61
|
+
|
|
62
|
+
## Workflow diagram style guide
|
|
63
|
+
|
|
64
|
+
When a skill includes a workflow diagram, follow these rules so it renders
|
|
65
|
+
reliably in any CLI:
|
|
66
|
+
|
|
67
|
+
- **ASCII only** — never Mermaid, images, or unicode box-drawing characters.
|
|
68
|
+
Keep to `|`, `-`, `>`, `+`, and `v`.
|
|
69
|
+
- **Fenced block** — wrap the diagram in a fenced code block so monospace is
|
|
70
|
+
preserved.
|
|
71
|
+
- **At most 80 characters per line** — narrow enough for terminal-width readers.
|
|
72
|
+
- **Short box labels** — imperative verbs or nouns (e.g. `[Validate scope]`),
|
|
73
|
+
never full sentences.
|
|
74
|
+
- **Read left-to-right, top-down** — prefer one branch level over dense joins.
|
|
75
|
+
- **Mirror the numbered workflow** — the diagram is a glanceable summary of the
|
|
76
|
+
`## Workflow` steps, never a source of truth that contradicts them.
|
|
60
77
|
|
|
61
78
|
## Section ordering
|
|
62
79
|
|
|
@@ -92,6 +109,7 @@ A skill passes anatomy review when:
|
|
|
92
109
|
- [ ] Tool references use `{{TOOL:name}}` tokens, not hardcoded tool names.
|
|
93
110
|
- [ ] Required sections exist and follow canonical ordering.
|
|
94
111
|
- [ ] Optional sections (if present) include what/when/example guidance.
|
|
112
|
+
- [ ] Workflow diagrams (if present) are ASCII-only and follow the workflow diagram style guide.
|
|
95
113
|
- [ ] Verification checklist contains concrete, machine-checkable items.
|
|
96
114
|
- [ ] Supporting docs are split by purpose when `SKILL.md` would exceed ~150 lines.
|
|
97
115
|
|
|
@@ -119,8 +137,26 @@ disable-model-invocation: false
|
|
|
119
137
|
## Workflow
|
|
120
138
|
|
|
121
139
|
1. Gather required context and validate scope boundaries.
|
|
122
|
-
2.
|
|
123
|
-
3.
|
|
140
|
+
2. Reject early with the reason when validation fails; otherwise continue.
|
|
141
|
+
3. Execute deterministic steps in order, recording key decisions.
|
|
142
|
+
4. Produce the required output artifact or terminal response.
|
|
143
|
+
|
|
144
|
+
Workflow at a glance (include only when the flow branches):
|
|
145
|
+
|
|
146
|
+
[Trigger]
|
|
147
|
+
|
|
|
148
|
+
v
|
|
149
|
+
[Gather context]
|
|
150
|
+
|
|
|
151
|
+
v
|
|
152
|
+
[Validate scope] --(invalid)--> [Reject early]
|
|
153
|
+
|
|
|
154
|
+
(valid)
|
|
155
|
+
v
|
|
156
|
+
[Run deterministic steps]
|
|
157
|
+
|
|
|
158
|
+
v
|
|
159
|
+
[Produce output artifact]
|
|
124
160
|
|
|
125
161
|
## Red Flags
|
|
126
162
|
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Technical Direction: Execution-Label Migration Tooling (two-axis model)
|
|
2
|
+
|
|
3
|
+
## Problem and target outcome
|
|
4
|
+
|
|
5
|
+
- Migrate all beads workspaces from `implementation-type:afk|hitl` to `execution:afk|hitl`
|
|
6
|
+
(strict rename, agent-agnostic) as part of the two-axis workflow model epic.
|
|
7
|
+
- Provide a repo-agnostic tool + skill any workspace can run, and a single-package.json
|
|
8
|
+
script tooling story across the agent-cortex repo.
|
|
9
|
+
|
|
10
|
+
## Current-state constraints
|
|
11
|
+
|
|
12
|
+
- bd CLI is a global binary (`~/.local/bin/bd`); label ops: `bd label list-all [--json]`,
|
|
13
|
+
`bd list --label-pattern/regex [--json]`, `bd label add/remove` (batch multiple ids).
|
|
14
|
+
- `bd list` supports `--label-pattern`/`--json`; `bd count` does NOT support `--label-pattern`.
|
|
15
|
+
- `bd ready --label-pattern 'stage:*'` works; `bd ready -l execution:afk` verified.
|
|
16
|
+
- 3 script packages exist with per-skill `package.json` + own `pnpm-workspace.yaml` +
|
|
17
|
+
own `pnpm-lock.yaml` (create-task, validate-agent-dir, run-pipeline-stage). They are NOT
|
|
18
|
+
members of the root workspace (root glob `skills/*/scripts` does not match the nested
|
|
19
|
+
`skills/<domain>/<name>/scripts`; root lockfile has zero refs to them).
|
|
20
|
+
- All 3 scripts are stdlib-only (`node:child_process`, `node:fs`, `node:path`, `node:url`).
|
|
21
|
+
- Extensions (`extensions/skill-stats`) have real peer deps on `@earendil-works/pi-coding-agent`
|
|
22
|
+
— they remain workspace members with their own package.json.
|
|
23
|
+
- `node_modules` gitignored; per-skill modules are installed manually today — a fragility in
|
|
24
|
+
fresh clones and PI-installed contexts.
|
|
25
|
+
|
|
26
|
+
## Decisions (locked in planning session)
|
|
27
|
+
|
|
28
|
+
### D1: Script runtime — all skill scripts become zero-dep `.mjs` with `// @ts-check`
|
|
29
|
+
|
|
30
|
+
- Every script in `skills/*/*/scripts/` runs with bare `node` (built-ins + shelling out to
|
|
31
|
+
`bd`). No tsx, no node_modules at runtime, no skill-scripts-dir resolution problem in any
|
|
32
|
+
installed context.
|
|
33
|
+
- Build-in-publish (Option B) rejected: contradicts the repo's no-compilation PI package
|
|
34
|
+
model; 3 tiny stdlib-only scripts do not justify dist artifacts.
|
|
35
|
+
- Root keeps `tsx`/`typescript`/`@types/node` for extensions and for `tsc --noEmit`
|
|
36
|
+
typechecking of `.mjs` via `checkJs`.
|
|
37
|
+
|
|
38
|
+
### D2: Single package.json (root workspace consolidation)
|
|
39
|
+
|
|
40
|
+
- Fold the 3 per-skill script packages into the root workspace: delete their `package.json`,
|
|
41
|
+
`pnpm-workspace.yaml`, `pnpm-lock.yaml`; convert scripts to `.mjs` (D1); root
|
|
42
|
+
`package.json` owns typecheck/test wiring.
|
|
43
|
+
- Extensions stay as workspace members (`extensions/*` glob) — their package.jsons are
|
|
44
|
+
semantically meaningful (peer deps on the pi runtime).
|
|
45
|
+
- Fresh-clone/installed-context verification: `pnpm install` at root then
|
|
46
|
+
`pnpm -r typecheck` + `pnpm -r test` (or root `node --test` wiring) cover all scripts.
|
|
47
|
+
|
|
48
|
+
### D3: Migration tool shape
|
|
49
|
+
|
|
50
|
+
- Script: `skills/productivity/migration/scripts/rename-execution-labels.mjs` — zero-dep,
|
|
51
|
+
`// @ts-check` + JSDoc.
|
|
52
|
+
- Behavior:
|
|
53
|
+
1. Enumerate: `bd list --label-pattern 'implementation-type:*' --json`.
|
|
54
|
+
2. Group bead ids by label value (afk | hitl). A bead carrying both gets both execution labels.
|
|
55
|
+
3. Dry-run (default): print per-bead plan + summary counts; zero writes; exit 0.
|
|
56
|
+
4. Apply (`--apply`): batched `bd label add execution:<v> <ids...>` then
|
|
57
|
+
`bd label remove implementation-type:<v> <ids...>` per group.
|
|
58
|
+
5. Idempotent: re-run finds zero targets → no-op.
|
|
59
|
+
6. Fail loudly if `bd` unavailable or any subcommand errors.
|
|
60
|
+
- Scope: rename ALL beads carrying `implementation-type:*` (including closed) — the F7
|
|
61
|
+
acceptance "zero implementation-type:* labels remain" requires it, and bd label history
|
|
62
|
+
tolerates it.
|
|
63
|
+
|
|
64
|
+
### D4: Migration skill
|
|
65
|
+
|
|
66
|
+
- Location: `skills/productivity/migration/SKILL.md` (productivity = workflow tooling).
|
|
67
|
+
- Docs the full sequence for any workspace: preflight (count via `bd label list-all`),
|
|
68
|
+
dry-run, apply, post-checks (grep stale refs; `bd ready -l execution:afk` smoke), plus
|
|
69
|
+
pointers to idea-file migration (F2) and skill/doc updates (F3/F4/F5/F6).
|
|
70
|
+
- Repo-agnostic: no agent-cortex-specific paths in the runnable steps.
|
|
71
|
+
|
|
72
|
+
### D6: npm packaging hygiene (no build step — F9)
|
|
73
|
+
|
|
74
|
+
- The npm tarball currently ships the whole repo, including `.beads/` (the live task DB),
|
|
75
|
+
`.github/`, `.changeset/`, `.junie/`, tests, and token-map.json. No `.npmignore`, no
|
|
76
|
+
`files` field.
|
|
77
|
+
- Rejected: a compile build. Scripts are zero-dep `.mjs` (D1) — nothing to transpile;
|
|
78
|
+
extensions are TS by pi contract (`index.ts` entrypoint, loader transpiles; the pi runtime
|
|
79
|
+
import is type-only). Root build script is deliberately a no-op.
|
|
80
|
+
- Chosen: (1) `files` whitelist in package.json — ship only runtime assets (skills/, agents/,
|
|
81
|
+
extensions/, bin/, lib/, AGENTS.md, plugin.json, README, LICENSE); (2) `prepublishOnly`
|
|
82
|
+
gate running `pnpm typecheck && pnpm test`; (3) wire `test/cli.test.mjs` into root `test`.
|
|
83
|
+
- Revisit trigger: if an extension ever gains real runtime deps, bundle that extension with
|
|
84
|
+
esbuild at prepack — not a repo-wide build.
|
|
85
|
+
|
|
86
|
+
### D5: Knocked-on invocation changes (F4/F5)
|
|
87
|
+
|
|
88
|
+
- ralph init step 9: `pnpm --prefix skills/workflow/run-pipeline-stage/scripts exec tsx
|
|
89
|
+
generate-progress.ts` → `node <abs>/generate-progress.mjs`.
|
|
90
|
+
- create-task chore creation: `<skill-scripts>/node_modules/.bin/tsx create-chores.ts` →
|
|
91
|
+
`node <abs>/create-chores.mjs`.
|
|
92
|
+
|
|
93
|
+
## Options considered
|
|
94
|
+
|
|
95
|
+
### Option A: all scripts zero-dep `.mjs` (chosen)
|
|
96
|
+
- Pros: node-only everywhere; no install step; kills resolution problem; `node --test` native.
|
|
97
|
+
- Cons: JSDoc typing instead of TS syntax; small convention shift (`.ts` → `.mjs`).
|
|
98
|
+
|
|
99
|
+
### Option B: keep `.ts`, build in publish pipeline
|
|
100
|
+
- Pros: full TS syntax.
|
|
101
|
+
- Cons: compile step + dist artifacts contradict no-build PI package; installed contexts must
|
|
102
|
+
ship/install built output; over-engineered for 3 stdlib-only scripts.
|
|
103
|
+
|
|
104
|
+
### Option C: per-skill tsx packages (status quo, rejected)
|
|
105
|
+
- Pros: existing pattern.
|
|
106
|
+
- Cons: 3 orphaned mini-workspaces, manual install fragility, resolution doc dance
|
|
107
|
+
(`<skill-scripts>/node_modules/.bin/tsx`), contradicts single-package.json preference.
|
|
108
|
+
|
|
109
|
+
## Tradeoffs accepted
|
|
110
|
+
|
|
111
|
+
- Scripts use JSDoc annotations where types matter; `tsc --noEmit` with `checkJs` keeps a
|
|
112
|
+
typecheck gate at root.
|
|
113
|
+
- Closed beads get their history labels renamed — accepted for a clean label space.
|
|
114
|
+
|
|
115
|
+
## Validation plan
|
|
116
|
+
|
|
117
|
+
- F1-T3: scratch beads workspace (temp dir): create test beads with both labels + a dep pair,
|
|
118
|
+
dry-run (assert zero writes), apply, verify rename, re-run idempotence, `bd ready -l
|
|
119
|
+
execution:afk` smoke, then run the migration skill end-to-end once.
|
|
120
|
+
- F8-T3: fresh clone (or temp copy) + `pnpm install` at root; `pnpm -r typecheck` and
|
|
121
|
+
`pnpm -r test` green; scripts execute via bare `node`.
|
|
122
|
+
|
|
123
|
+
## Revisit triggers
|
|
124
|
+
|
|
125
|
+
- A future script needs third-party deps at runtime → revisit D1 (either root dep or
|
|
126
|
+
per-package re-introduction).
|
|
127
|
+
- New extension with conflicting devDeps → revisit D2 membership rules.
|
|
128
|
+
|
|
129
|
+
## References
|
|
130
|
+
|
|
131
|
+
- Code evidence: `skills/*/scripts/package.json` (3 orphaned), root `package.json` +
|
|
132
|
+
`pnpm-workspace.yaml`, bd CLI help (`bd list`, `bd label`), epic `agnt-ctx-s5xd` notes.
|
package/lib/cli.mjs
CHANGED
|
@@ -66,9 +66,15 @@ Commands:
|
|
|
66
66
|
install <harness> Install agent-cortex for a harness
|
|
67
67
|
Supported harnesses: ${SUPPORTED_HARNESSES.join(", ")}
|
|
68
68
|
Options (claude):
|
|
69
|
-
--output
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
(no --output) Generate the plugin subtree AND register it
|
|
70
|
+
with Claude Code via the "claude plugin" CLI
|
|
71
|
+
(marketplace add → install → update) — requires
|
|
72
|
+
the plugin CLI (Claude Code v2+)
|
|
73
|
+
--output <dir> Write the plugin subtree to <dir> only — no
|
|
74
|
+
runtime registration (default: <package
|
|
75
|
+
root>/claude)
|
|
76
|
+
--dry-run Print what would be generated/registered
|
|
77
|
+
without writing
|
|
72
78
|
Options (copilot):
|
|
73
79
|
--output <dir> Write the flat *.agent.md files to <dir>
|
|
74
80
|
(default: <package root>/agents — the dir
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaybeeuu/agent-cortex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.0",
|
|
4
4
|
"description": "Personal PI package with custom agents, skills, and extensions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"lint": "pnpm typecheck",
|
|
32
32
|
"test": "node --test test/*.test.mjs && pnpm -r test",
|
|
33
33
|
"typecheck": "pnpm -r typecheck",
|
|
34
|
-
"build:claude": "node bin/agent-cortex.mjs install claude",
|
|
34
|
+
"build:claude": "node bin/agent-cortex.mjs install claude --output claude",
|
|
35
35
|
"build:copilot": "node scripts/build-copilot-agents.mjs",
|
|
36
36
|
"changeset": "changeset",
|
|
37
37
|
"version-packages": "changeset version && bash scripts/sync-plugin-version.sh && pnpm build:claude && pnpm build:copilot",
|
package/plugin.json
CHANGED
package/pnpm-workspace.yaml
CHANGED
|
@@ -1,94 +1,114 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: design-an-interface
|
|
3
|
-
description: Generate multiple radically different interface designs for a module
|
|
3
|
+
description: "Generate multiple radically different interface designs for a module via parallel sub-agents, then compare and synthesize. Use when designing an API, exploring interface options, or \"design it twice\"."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Design an Interface
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## When to use
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
- The user wants to design an API, module boundary, or public interface.
|
|
11
|
+
- The user asks to explore interface options or compare module shapes.
|
|
12
|
+
- The user mentions "design it twice" or says the first idea is unlikely to be the best.
|
|
13
|
+
- An interface design step needs a guided parallel exploration — `improve-codebase-architecture` invokes this skill for its multi-design step.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## When NOT to use
|
|
15
16
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- [ ] Any constraints? (performance, compatibility, existing patterns)
|
|
20
|
-
- [ ] What should be hidden inside vs exposed?
|
|
17
|
+
- The user wants a single justified recommendation with tradeoff analysis — use `technical-direction` instead.
|
|
18
|
+
- The module's shape is already fixed by an upstream contract or framework, so exploring alternatives is wasted effort.
|
|
19
|
+
- The question is about implementation strategy, not interface shape.
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
## Philosophy / rationale
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
- **Your first idea is unlikely to be the best.** "Design It Twice" (John Ousterhout, *A Philosophy of Software Design*) holds that the first design is almost never the strongest. Generating multiple radically different candidates forces the comparison that finds the best shape.
|
|
24
|
+
- **Contrast, not volume, creates insight.** Similar designs from parallel agents only confirm one idea. Each agent is assigned a different constraint so divergence is guaranteed by construction.
|
|
25
|
+
- **Interface shape is the whole problem here.** The process stops at the interface — implementation effort is irrelevant to the comparison, because a good interface usually makes the implementation easier, not harder. Judging designs by implementation cost rewards shallow modules.
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
## Workflow
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
1. **Gather requirements.** Before designing, pin down:
|
|
30
|
+
- What problem does the module solve?
|
|
31
|
+
- Who are the callers (other modules, external users, tests)?
|
|
32
|
+
- What are the key operations?
|
|
33
|
+
- What constraints apply (performance, compatibility, existing patterns)?
|
|
34
|
+
- What should be hidden inside vs exposed?
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
Ask: "What does this module need to do? Who will use it?"
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
2. **Generate designs with parallel sub-agents.** Spawn 3+ sub-agents simultaneously with {{TOOL:task}}, each assigned a **different** constraint to guarantee radical difference. Use this prompt template per agent:
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- Agent 2: "Maximize flexibility - support many use cases"
|
|
38
|
-
- Agent 3: "Optimize for the most common case"
|
|
39
|
-
- Agent 4: "Take inspiration from [specific paradigm/library]"
|
|
40
|
+
```
|
|
41
|
+
Design an interface for: [module description]
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
1. Interface signature (types/methods)
|
|
43
|
-
2. Usage example (how caller uses it)
|
|
44
|
-
3. What this design hides internally
|
|
45
|
-
4. Trade-offs of this approach
|
|
46
|
-
```
|
|
43
|
+
Requirements: [gathered requirements]
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
Constraints for this design: [assign a different constraint to each agent]
|
|
46
|
+
- Agent 1: "Minimize method count — aim for 1-3 methods max"
|
|
47
|
+
- Agent 2: "Maximize flexibility — support many use cases"
|
|
48
|
+
- Agent 3: "Optimize for the most common case"
|
|
49
|
+
- Agent 4: "Take inspiration from [specific paradigm/library]"
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
Output format:
|
|
52
|
+
1. Interface signature (types/methods)
|
|
53
|
+
2. Usage example (how a caller uses it)
|
|
54
|
+
3. What this design hides internally
|
|
55
|
+
4. Trade-offs of this approach
|
|
56
|
+
```
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
2. **Usage examples** - how callers actually use it in practice
|
|
54
|
-
3. **What it hides** - complexity kept internal
|
|
58
|
+
Collect each agent's output with {{TOOL:read_agent}} when it finishes.
|
|
55
59
|
|
|
56
|
-
Present designs sequentially so user
|
|
60
|
+
3. **Present designs.** Show each design sequentially — signature, usage examples, what it hides — so the user absorbs each approach before any comparison happens.
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
4. **Compare designs.** Compare in prose, not tables, on:
|
|
63
|
+
- **Interface simplicity** — fewer methods, simpler params
|
|
64
|
+
- **General-purpose vs specialized** — flexibility vs focus
|
|
65
|
+
- **Implementation efficiency** — does the shape allow efficient internals?
|
|
66
|
+
- **Depth** — small interface hiding significant complexity (deep module, good) vs large interface with thin implementation (shallow module, avoid)
|
|
67
|
+
- **Ease of correct use** vs ease of misuse
|
|
59
68
|
|
|
60
|
-
|
|
69
|
+
Highlight where the designs diverge most — that divergence is where the decision lives.
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
- **General-purpose vs specialized**: flexibility vs focus
|
|
64
|
-
- **Implementation efficiency**: does shape allow efficient internals?
|
|
65
|
-
- **Depth**: small interface hiding significant complexity (good) vs large interface with thin implementation (bad)
|
|
66
|
-
- **Ease of correct use** vs **ease of misuse**
|
|
71
|
+
5. **Synthesize.** Ask: "Which design best fits your primary use case?" and "What elements from other designs are worth incorporating?" Often the best design combines insights from multiple options.
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
## Red Flags
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
- **Sub-agents converging on similar designs** — if two agents produce near-identical shapes, re-run with sharper, more opposed constraints. Similarity means the contrast step lost its value.
|
|
76
|
+
- **Skipping comparison** — jumping from presentation to a favorite design discards the whole point of exploring alternatives.
|
|
77
|
+
- **Sliding into implementation** — this process concerns interface shape only. Implementation details belong in a follow-up task.
|
|
78
|
+
- **Judging designs by implementation effort** — a design that looks harder to build may still be the deeper, better interface.
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
## Common Rationalizations
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
| Rationalization | Rebuttal |
|
|
83
|
+
|---|---|
|
|
84
|
+
| "My first design is probably fine" | That is exactly the assumption "design it twice" exists to break. Generate the alternatives before committing. |
|
|
85
|
+
| "The agents will just produce similar things, so why bother" | Similarity is a failure mode you control — assign opposed constraints so divergence is guaranteed by construction. |
|
|
86
|
+
| "I can compare these myself, no need to present each one" | Sequential presentation forces you to articulate what each design actually is before judging it, which is where the insight comes from. |
|
|
76
87
|
|
|
77
|
-
##
|
|
88
|
+
## Phase-gate checklists
|
|
78
89
|
|
|
79
|
-
|
|
90
|
+
- [ ] Phase 1 complete: requirements gathered and constraints listed
|
|
91
|
+
- [ ] Phase 2 complete: 3+ designs returned, each constrained differently
|
|
92
|
+
- [ ] Phase 3 complete: all designs presented sequentially
|
|
93
|
+
- [ ] Phase 4 complete: comparison shared and divergence highlighted
|
|
94
|
+
- [ ] Phase 5 complete: candidate synthesized with user input
|
|
80
95
|
|
|
81
|
-
|
|
96
|
+
## Cross-skill references
|
|
82
97
|
|
|
83
|
-
|
|
98
|
+
- `improve-codebase-architecture` invokes this skill for its multi-design step (step 5 of its workflow).
|
|
99
|
+
- Run `grill-with-docs` when the module's domain terminology is unsettled — design names should match the ubiquitous language.
|
|
84
100
|
|
|
85
|
-
|
|
101
|
+
## Examples
|
|
86
102
|
|
|
87
|
-
|
|
103
|
+
Input: "Design the interface for a rate limiter module"
|
|
104
|
+
Output: four radically different interface sketches (minimal-method, flexible, common-case-optimized, paradigm-inspired), presented sequentially, compared on simplicity, depth, and trade-offs, then synthesized into one recommended shape with the user.
|
|
88
105
|
|
|
89
|
-
##
|
|
106
|
+
## Verification checklist
|
|
90
107
|
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
108
|
+
- [ ] Requirements captured before any sub-agent is spawned
|
|
109
|
+
- [ ] At least 3 sub-agents spawned, each with a distinct constraint
|
|
110
|
+
- [ ] Each design reports signature, usage example, hidden complexity, and trade-offs
|
|
111
|
+
- [ ] Designs presented sequentially before any comparison
|
|
112
|
+
- [ ] Comparison covers simplicity, generality, efficiency, depth, and ease of correct use
|
|
113
|
+
- [ ] Synthesis asks the user which design fits their primary use case
|
|
114
|
+
- [ ] No implementation work performed — interface shape only
|