@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
|
@@ -1,65 +1,50 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: init-beads
|
|
3
|
-
description: Install and initialise the beads (bd) task-tracker in the current project using stealth mode. Use when the user wants to set up beads, install bd, initialise beads, or mentions "bd init".
|
|
3
|
+
description: Install and initialise the beads (bd) task-tracker in the current project using stealth mode. Use when the user wants to "set up beads", "install bd", "initialise beads", or mentions "bd init".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Init Beads
|
|
7
7
|
|
|
8
|
-
Install and initialise the `bd` CLI task tracker in the current project
|
|
8
|
+
Install and initialise the `bd` CLI task tracker in the current project, running in stealth mode: minimise commits to the main repo, git hooks, and questions to the user.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## When to use
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
brew install beads # macOS/Linux (preferred)
|
|
15
|
-
npm install -g @beads/bd # fallback
|
|
12
|
+
- The user asks to "set up beads", "install bd", "initialise beads", or "run bd init" in a project — or mentions beads tracking with no setup present.
|
|
13
|
+
- A project has no `.beads/` directory yet and the user wants task tracking enabled.
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
## When NOT to use
|
|
16
|
+
|
|
17
|
+
- The project already has `.beads/`, or the user wants to work with existing beads rather than set them up — use `bd-tool` instead.
|
|
18
|
+
- The user explicitly asks for git hooks or an interactive wizard — `bd init --stealth` deliberately skips both.
|
|
20
19
|
|
|
21
20
|
## Workflow
|
|
22
21
|
|
|
23
22
|
### 1. Check if `bd` is installed
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
which bd || bd version
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If missing, install silently:
|
|
24
|
+
Run `which bd || bd version`. If missing, install silently — prefer Homebrew → npm → script, detect the best method from the environment, and decide without asking:
|
|
30
25
|
|
|
31
26
|
| Platform | Command |
|
|
32
|
-
|
|
27
|
+
|---|---|
|
|
33
28
|
| macOS / Linux (Homebrew) | `brew install beads` |
|
|
34
29
|
| npm available | `npm install -g @beads/bd` |
|
|
35
30
|
| Go available | `go install github.com/steveyegge/beads/cmd/bd@latest` |
|
|
36
31
|
| Any (script) | `curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh \| bash` |
|
|
37
32
|
|
|
38
|
-
Prefer Homebrew → npm → script. Do NOT ask the user which method to use — detect and decide.
|
|
39
|
-
|
|
40
33
|
### 2. Check if beads is already initialised
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
bd version 2>/dev/null && ls .beads/ 2>/dev/null
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
If `.beads/` already exists, skip `bd init` and tell the user.
|
|
47
|
-
|
|
48
|
-
### 3. Initialise beads
|
|
35
|
+
Run `bd version 2>/dev/null && ls .beads/ 2>/dev/null`. If `.beads/` exists, skip `bd init` and tell the user beads is already set up.
|
|
49
36
|
|
|
50
|
-
|
|
37
|
+
### 3. Initialise beads in stealth mode
|
|
51
38
|
|
|
52
39
|
```bash
|
|
53
40
|
bd init --quiet --stealth
|
|
54
41
|
```
|
|
55
42
|
|
|
56
|
-
`--stealth
|
|
57
|
-
`--quiet` suppresses the interactive wizard.
|
|
43
|
+
Always pass `--quiet --stealth`: local-only init, no git hooks or commits to the main repo, no interactive wizard.
|
|
58
44
|
|
|
59
45
|
### 4. Update AGENTS.md
|
|
60
46
|
|
|
61
|
-
|
|
62
|
-
If it doesn't exist, create it.
|
|
47
|
+
Append the quick-reference block below to `AGENTS.md` if missing, or create `AGENTS.md` with this exact block:
|
|
63
48
|
|
|
64
49
|
```markdown
|
|
65
50
|
## Task tracking
|
|
@@ -73,21 +58,44 @@ Quick reference:
|
|
|
73
58
|
- `bd create "Title" -p <0-3>` — create a task (P0 = critical)
|
|
74
59
|
- `bd update <id> --claim` — claim a task
|
|
75
60
|
- `bd close <id>` — complete a task
|
|
61
|
+
- `bd dep add <A> <B>` — **"A depends on B"** (B blocks A). First arg waits, second arg
|
|
62
|
+
is waited-for. To express "X blocks Y", write `bd dep add Y X`.
|
|
76
63
|
- `bd dolt push` — sync to remote at session end
|
|
77
64
|
```
|
|
78
65
|
|
|
79
66
|
### 5. Report
|
|
80
67
|
|
|
81
|
-
Print a brief summary:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
Print a brief summary: whether `bd` was installed or already present, whether beads was initialised or already set up, and whether AGENTS.md was created or updated. Complete all steps first — do not pause to ask the user.
|
|
69
|
+
|
|
70
|
+
## Red Flags
|
|
71
|
+
|
|
72
|
+
- Red flag: running `bd init` without `--stealth` or `--quiet` — this installs git hooks or opens the interactive wizard.
|
|
73
|
+
- Red flag: asking the user which install method to use or whether to proceed — the skill is designed to run unattended.
|
|
74
|
+
- Red flag: committing `.beads/` or any init commit to the repo — stealth mode keeps them local-only.
|
|
75
|
+
|
|
76
|
+
## Common Rationalizations
|
|
77
|
+
|
|
78
|
+
| Rationalization | Rebuttal |
|
|
79
|
+
|---|---|
|
|
80
|
+
| "I'll skip `--stealth` so the user can see what happens" | Stealth mode is the contract of this skill — non-stealth init adds hooks and commits the user never asked for. |
|
|
81
|
+
| "I should ask before installing software on the user's machine" | Installing `bd` is the requested outcome; asking adds friction and the skill is meant to run headless. |
|
|
82
|
+
|
|
83
|
+
## Cross-skill references
|
|
84
|
+
|
|
85
|
+
- Use `bd-tool` for day-to-day beads usage once initialised — `bd prime`, `bd ready`, `bd create`, `bd close`.
|
|
86
|
+
- Use `create-task` to create tasks with pipeline-stage expansion and a HITL review gate.
|
|
87
|
+
|
|
88
|
+
## Examples
|
|
89
|
+
|
|
90
|
+
Input: "Set up beads in this repo" → output report example:
|
|
85
91
|
|
|
86
|
-
|
|
92
|
+
- `bd: installed via Homebrew`
|
|
93
|
+
- `beads: initialised in .beads/ (stealth, local-only)`
|
|
94
|
+
- `AGENTS.md: appended task-tracking quick reference`
|
|
87
95
|
|
|
88
|
-
##
|
|
96
|
+
## Verification checklist
|
|
89
97
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
98
|
+
- [ ] `bd` is installed (or was already present) and `bd version` succeeds
|
|
99
|
+
- [ ] `.beads/` exists in the project — stealthed init, no git hooks installed, no repo commits made
|
|
100
|
+
- [ ] `bd prime` runs without error in the project
|
|
101
|
+
- [ ] AGENTS.md contains the task-tracking quick-reference block exactly once (created or appended) and the summary report covers install, init, and AGENTS.md status
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../typescript/bin/tsc" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.23.12/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.23.12/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.23.12/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.23.12/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
21
|
+
fi
|
|
@@ -25,7 +25,7 @@ Clarify the skill goal with the user. Ask what triggers users would actually say
|
|
|
25
25
|
|
|
26
26
|
### 2. Draft from the anatomy template
|
|
27
27
|
|
|
28
|
-
Read `docs/skills/skill-anatomy.md` as the source of truth. Follow the annotated template for section ordering and front-matter fields. Target ~150 lines for `SKILL.md` but stay under the 150-line hard cap.
|
|
28
|
+
Read `docs/skills/skill-anatomy.md` as the source of truth. Follow the annotated template for section ordering and front-matter fields. Target ~150 lines for `SKILL.md` but stay under the 150-line hard cap. When the workflow branches or has decision points, include one inline ASCII workflow diagram per the anatomy doc's diagram style guide — ASCII only, never Mermaid.
|
|
29
29
|
|
|
30
30
|
### 3. Apply voice and tone rules
|
|
31
31
|
|
|
@@ -65,6 +65,7 @@ Output: A new `skills/review-security/SKILL.md` with front matter, When to use,
|
|
|
65
65
|
- [ ] `docs/skills/skill-anatomy.md` was read before drafting
|
|
66
66
|
- [ ] Required sections present: `## When to use`, `## Workflow`, `## Verification checklist`
|
|
67
67
|
- [ ] Section order follows the anatomy template
|
|
68
|
+
- [ ] Workflow diagram (if present) is ASCII-only and follows the anatomy diagram style guide
|
|
68
69
|
- [ ] Description uses two-sentence format with 2-4 quoted trigger phrases
|
|
69
70
|
- [ ] Body uses imperative second-person voice with positive framing
|
|
70
71
|
- [ ] Rationale sentences added for non-obvious rules
|
|
@@ -1,83 +1,103 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: maintain-agent-docs
|
|
3
|
-
description:
|
|
3
|
+
description: Audits and updates AGENTS.md and docs/ to keep agent-consumed documentation accurate, specific, and drift-free. Use when asked to "review AGENTS.md", "check the docs are current", or "fix docs drift".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Maintain Agent Docs
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## When to use
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- After significant codebase changes — new tooling, renamed modules, changed workflows — leave agent instructions stale.
|
|
11
|
+
- When agents produce poor results due to outdated or missing instructions.
|
|
12
|
+
- Periodic maintenance, after a major release, or when onboarding a new repository to agent-assisted workflows.
|
|
13
|
+
- Trigger phrases: "review AGENTS.md", "check the docs are current", "fix docs drift", "update the agent docs".
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
- When agents are producing poor results due to stale or missing instructions
|
|
14
|
-
- Periodic maintenance — or after major releases
|
|
15
|
-
- When onboarding a new repo to agent-assisted workflows
|
|
15
|
+
## When NOT to use
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
- Deciding what to document or whether a doc is needed — `style-documentation` owns that call; this skill applies it during the audit.
|
|
18
|
+
- Creating or refactoring a skill — use `write-a-skill` or `refactor-skill`.
|
|
19
|
+
- Editing a single doc without auditing the codebase — that is ordinary doc-writing, not maintenance.
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## Philosophy / rationale
|
|
22
|
+
|
|
23
|
+
- **AGENTS.md is an index of expensive truths.** It is injected into every agent conversation, so every line costs tokens and attention. Bloated context files reduce task success while increasing cost (ETH Zurich, ICSE 2026); instructions past the first sections get less attention ("Lost in the Middle", Stanford). Include only what the codebase cannot answer on its own.
|
|
24
|
+
- **Progressive disclosure by need.** Root AGENTS.md stays under 100 lines; path-specific `.instructions.md` files load on demand; depth lives in `docs/` read when needed. When auditing, ask: "Does this line resolve an ambiguity that the code alone cannot?" If not, move it down a level or remove it.
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
## Workflow
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
- Compare instructions against actual codebase: directory structure, runnable commands, conventions, tooling
|
|
25
|
-
- Check context budget: is AGENTS.md under 100 lines? Is detail pushed to scoped files?
|
|
26
|
-
- Flag issues, grouped by type:
|
|
27
|
-
- **Drift** — instructions that no longer match the codebase
|
|
28
|
-
- **Gaps** — important context missing entirely
|
|
29
|
-
- **Vagueness** — instructions too generic to be actionable
|
|
30
|
-
- **Bloat** — content that belongs in scoped files or docs/, not the root
|
|
28
|
+
### 1. Audit
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
- Read AGENTS.md (root and any nested copies), scoped `.instructions.md` files, and `docs/` contents.
|
|
31
|
+
- Compare instructions against the actual codebase: directory structure, runnable commands, conventions, tooling.
|
|
32
|
+
- Check the context budget — is AGENTS.md under 100 lines, with detail pushed to scoped files?
|
|
33
|
+
- Flag findings grouped by type: **Drift** (no longer matches), **Gaps** (missing context), **Vagueness** (too generic to act on), **Bloat** (belongs in scoped files or `docs/`). Present them as a numbered list; fix nothing yet.
|
|
33
34
|
|
|
34
35
|
### 2. Propose changes
|
|
35
36
|
|
|
36
|
-
For each
|
|
37
|
+
For each finding, propose a specific fix. Present every proposal for review before applying anything.
|
|
37
38
|
|
|
38
39
|
### 3. Apply changes
|
|
39
40
|
|
|
40
|
-
After approval, update files following the quality principles below.
|
|
41
|
+
After approval, update files following the quality principles below. Verify commands by running them; update what changed, prune what drifted.
|
|
41
42
|
|
|
42
|
-
##
|
|
43
|
+
## Quality principles
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
1. **Specificity over generality** — `npm test -- --coverage`, not "run the tests".
|
|
46
|
+
2. **Commands up front** with exact flags — build, test, lint in the first section; position 1 gets the most attention.
|
|
47
|
+
3. **Examples over explanations** — one code snippet beats one paragraph of prose.
|
|
48
|
+
4. **Cover six core areas** — commands, testing, project structure, code style, git workflow, boundaries.
|
|
49
|
+
5. **Explicit boundaries and tech stack with versions** — what agents must NOT do, with reasons; "React 18, TypeScript 5.x", not "a React project".
|
|
50
|
+
6. **Drift-resistant and non-duplicative** — stable concepts (directory purposes) over file lists; reference other docs, do not restate them.
|
|
51
|
+
7. **Progressive disclosure, sparse and maintained** — path-specific detail moves into scoped files or `docs/`; every line must earn its place.
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
See [REFERENCE.md](REFERENCE.md) for templates, examples, and detailed section guidance.
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
## Red Flags
|
|
49
56
|
|
|
50
|
-
|
|
57
|
+
- **Fixing findings during the audit.** The propose gate exists because the user knows which imperfections are intentional.
|
|
58
|
+
- **Adding without pruning.** A new section that does not displace a stale one bloats every conversation.
|
|
59
|
+
- **Trusting docs without running the commands.** A command that errors is drift, however plausible it reads.
|
|
60
|
+
- **Auditing only the root file.** Nested `.instructions.md` and `docs/` drift just as easily.
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
2. **Scoped `.instructions.md`** — path-specific guidance loaded only when the agent works in that area. Use `applyTo` globs to target file types or directories.
|
|
54
|
-
3. **docs/** — deeper context (architecture, ADRs, runbooks) that agents can read on demand but shouldn't carry in every conversation.
|
|
62
|
+
## Common Rationalizations
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
| Rationalization | Rebuttal |
|
|
65
|
+
|---|---|
|
|
66
|
+
| "I'll just fix this one drift directly" | Bypassing the propose gate skips the user's chance to flag intentional imperfections. |
|
|
67
|
+
| "Adding one line is harmless" | Every line costs tokens in every conversation. Sparse accurate beats comprehensive drift. |
|
|
68
|
+
| "The commands are obvious" | Obvious to you, guessed wrong by agents. Verify by running them. |
|
|
69
|
+
| "More detail helps agents" | Bloated context files measurably reduce task success. |
|
|
70
|
+
| "This file is small, it's fine" | Small does not mean current. Only cross-checking against the code reveals drift. |
|
|
57
71
|
|
|
58
|
-
##
|
|
72
|
+
## Phase-gate checklist
|
|
59
73
|
|
|
60
|
-
1
|
|
61
|
-
|
|
62
|
-
3. **Examples over explanations** — one code snippet > one paragraph of prose
|
|
63
|
-
4. **Six core areas** — commands, testing, project structure, code style, git workflow, boundaries
|
|
64
|
-
5. **Explicit boundaries** — state what agents must NOT do
|
|
65
|
-
6. **Tech stack with versions** — "React 18, TypeScript 5.x, Vite" not "a React project"
|
|
66
|
-
7. **Drift-resistant** — reference stable concepts (directory purposes, architectural decisions) over volatile details (file lists that change weekly)
|
|
67
|
-
8. **Progressive disclosure** — push path-specific or rarely-needed detail into scoped files or docs/, not the root AGENTS.md
|
|
68
|
-
9. **No duplication** — reference other docs, don't restate their content
|
|
69
|
-
10. **Sparse and maintained** — every line must earn its place; a short accurate file outperforms a comprehensive stale one
|
|
74
|
+
- [ ] Phase 1 complete: audit findings presented as a numbered list; nothing fixed yet.
|
|
75
|
+
- [ ] Phase 2 complete: every proposal reviewed and approved before applying.
|
|
70
76
|
|
|
71
|
-
##
|
|
77
|
+
## Cross-skill references
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
| When you need… | Use this skill |
|
|
80
|
+
|---|---|
|
|
81
|
+
| What and whether to document | `style-documentation` |
|
|
82
|
+
| Tone, structure, and concision for the writing | `style-comms` |
|
|
83
|
+
| Creating or refactoring a skill | `write-a-skill`, `refactor-skill` |
|
|
84
|
+
| Scanning changes for leaked secrets | `review-security` |
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
- [ ] How to build, test, and lint (exact commands)
|
|
77
|
-
- [ ] Project structure (directory map with purposes)
|
|
78
|
-
- [ ] Code style and conventions (with examples)
|
|
79
|
-
- [ ] Git workflow (branching, commit, PR conventions)
|
|
80
|
-
- [ ] Boundaries (forbidden files, actions, patterns)
|
|
81
|
-
- [ ] Testing approach (frameworks, coverage expectations)
|
|
86
|
+
## Examples
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
```
|
|
89
|
+
Findings:
|
|
90
|
+
1. [Drift] AGENTS.md says `pnpm run build` but package.json defines `build:dist`
|
|
91
|
+
2. [Gap] New scripts/ directory has no structure entry
|
|
92
|
+
3. [Bloat] Lines 40-52 restate README install steps word-for-word
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Verification checklist
|
|
96
|
+
|
|
97
|
+
- [ ] Every agent-consumed doc audited — root AGENTS.md, nested `.instructions.md`, `docs/` — and cross-checked against actual structure, commands, and tooling
|
|
98
|
+
- [ ] Findings grouped by drift/gap/vagueness/bloat and presented before any change
|
|
99
|
+
- [ ] All changes applied only after approval
|
|
100
|
+
- [ ] AGENTS.md under 100 lines; detail pushed to scoped files or `docs/`
|
|
101
|
+
- [ ] Commands listed in AGENTS.md verified runnable (build, test, lint)
|
|
102
|
+
- [ ] Content passes the "code alone cannot answer this" test — nothing restated or duplicated
|
|
103
|
+
- [ ] Changes scanned with `review-security` before committing
|
|
@@ -1,29 +1,98 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hitl-collab
|
|
3
|
-
description: Coordinates
|
|
3
|
+
description: Coordinates human-in-the-loop collaboration by writing a handoff document for a human reviewer and linking it from the bead. Use when a task needs human review or approval, manual steps agents cannot run, or a PR handoff — e.g. "hand this to a human", "what does the reviewer need", or "prepare the manual test run".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# HITL Collab
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## When to use
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
- Preparing a task handover where the next actor is a human, not an agent.
|
|
11
|
+
- The bead's acceptance criteria depend on reviewer judgment or steps only a human can run — sign-off, credentials, device access.
|
|
12
|
+
- A PR is ready and needs a human to test, review, and merge.
|
|
13
|
+
- You need durable context for a reviewer: what changed, what to run, and what to check.
|
|
13
14
|
|
|
14
|
-
##
|
|
15
|
+
## When NOT to use
|
|
15
16
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- **Acceptance criteria**
|
|
20
|
-
- **Manual steps**
|
|
21
|
-
- **Verification checklist**
|
|
22
|
-
- **References** (optional)
|
|
17
|
+
- The reader is another agent — use `handoff` to compact the conversation instead.
|
|
18
|
+
- No human gate exists and agents can verify and close the work themselves — run the pipeline directly with `run-pipeline-stage`.
|
|
19
|
+
- You only need bead bookkeeping or task state — use `bd-tool` instead.
|
|
23
20
|
|
|
24
21
|
## Workflow
|
|
25
22
|
|
|
26
|
-
1.
|
|
27
|
-
2. Write the handoff doc
|
|
28
|
-
3.
|
|
29
|
-
4.
|
|
23
|
+
1. Confirm the bead and its HITL gate with `bd show <bead-id>` (ID required). Pull PR/branch links, acceptance criteria, and any manual steps from the task description.
|
|
24
|
+
2. Write `.agent-cortex/working-docs/hitl/<bead-id>/handoff.md` using the handoff doc template below. Follow `style-comms` for tone and structure.
|
|
25
|
+
3. Keep supporting material — screenshots, logs, reproduction scripts — in the same `.agent-cortex/working-docs/hitl/<bead-id>/` directory; it is the collaboration home the reviewer works from.
|
|
26
|
+
4. Link the doc from the bead only when the bead is missing PR/branch links, manual steps, or acceptance criteria. Append — never replace: `bd update <bead-id> --append-notes "<doc path + missing details>"`. The plain `--notes` flag overwrites existing notes and would silently destroy prior context.
|
|
27
|
+
|
|
28
|
+
## Handoff doc template
|
|
29
|
+
|
|
30
|
+
Use these sections in this order, adapting headings to the task:
|
|
31
|
+
|
|
32
|
+
- **Summary** — one paragraph: what was built, its state, what remains.
|
|
33
|
+
- **Why HITL** — the gate that requires a human (approval, manual steps, judgment).
|
|
34
|
+
- **PR/branch links** — where the reviewer starts.
|
|
35
|
+
- **Acceptance criteria** — copied from the bead so the review is checkable.
|
|
36
|
+
- **Manual steps** — copy-runnable commands and actions for the human.
|
|
37
|
+
- **Verification checklist** — what the reviewer must confirm before signing off.
|
|
38
|
+
- **References** — optional links to specs, PRDs, ADRs.
|
|
39
|
+
|
|
40
|
+
## Red Flags
|
|
41
|
+
|
|
42
|
+
- Guessing the bead ID instead of running `bd show` — the doc lands in the wrong directory and the wrong task gets reviewed.
|
|
43
|
+
- Using `--notes` when the bead already carries notes — it replaces them; `--append-notes` preserves them.
|
|
44
|
+
- Writing the doc outside `.agent-cortex/working-docs/hitl/<bead-id>/` — it is lost when the worktree is discarded and downstream agents cannot find it.
|
|
45
|
+
|
|
46
|
+
## Common Rationalizations
|
|
47
|
+
|
|
48
|
+
| Rationalization | Rebuttal |
|
|
49
|
+
|---|---|
|
|
50
|
+
| "The human is in the room — no doc needed" | The doc is the durable record the reviewer works from; an in-session chat disappears when the session ends. |
|
|
51
|
+
| "The PR description already covers it" | The PR shows the diff, not the review protocol: what to run, what to check, and how to sign off. |
|
|
52
|
+
| "I'll compress everything into one bead note" | Notes are metadata. Manual steps and acceptance criteria belong in the doc where they survive and can be checked off. |
|
|
53
|
+
|
|
54
|
+
## Philosophy / rationale
|
|
55
|
+
|
|
56
|
+
- **Docs are the durable artifact; bead updates are pointers.** The document outlives the session and the worktree, so the human gate always has a stable review surface. The bead carries only what routing needs — links and the doc path.
|
|
57
|
+
|
|
58
|
+
## Cross-skill references
|
|
59
|
+
|
|
60
|
+
| When you need… | Use this skill |
|
|
61
|
+
|---|---|
|
|
62
|
+
| Tone, structure, and concision for the doc | `style-comms` |
|
|
63
|
+
| Conversation compaction for another agent | `handoff` |
|
|
64
|
+
| Bead discovery, queries, and state updates | `bd-tool` |
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
### Handoff doc skeleton
|
|
69
|
+
|
|
70
|
+
```md
|
|
71
|
+
# Handoff — agnt-ctx-123456
|
|
72
|
+
## Summary
|
|
73
|
+
Implemented X; tests pass; PR open.
|
|
74
|
+
## Why HITL
|
|
75
|
+
Needs sign-off on the API contract change.
|
|
76
|
+
## PR/branch links
|
|
77
|
+
- PR: https://github.com/jaybeeuu/agent-cortex/pull/42
|
|
78
|
+
- Branch: feature/agnt-ctx-123456
|
|
79
|
+
## Acceptance criteria
|
|
80
|
+
- [ ] Contract change approved by reviewer
|
|
81
|
+
## Manual steps
|
|
82
|
+
1. `pnpm install && pnpm test`
|
|
83
|
+
2. `pnpm build:claude && git diff --stat claude/`
|
|
84
|
+
## Verification checklist
|
|
85
|
+
- [ ] Tests pass locally
|
|
86
|
+
- [ ] Generated output up to date
|
|
87
|
+
## References
|
|
88
|
+
- PRD: docs/prds/api-contract.md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Verification checklist
|
|
92
|
+
|
|
93
|
+
- [ ] `bd show <bead-id>` confirmed the bead and HITL gate in scope
|
|
94
|
+
- [ ] Handoff doc written to `.agent-cortex/working-docs/hitl/<bead-id>/handoff.md`
|
|
95
|
+
- [ ] Doc covers Summary, Why HITL, PR/branch links, Acceptance criteria, Manual steps, and Verification checklist (References only where useful)
|
|
96
|
+
- [ ] Manual steps are commands a human can copy and run, not prose hints
|
|
97
|
+
- [ ] Bead notes include the doc path and any missing PR/branch links, manual steps, or acceptance criteria
|
|
98
|
+
- [ ] Existing bead notes preserved — used `--append-notes`, not `--notes`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Ralph — Reference
|
|
2
2
|
|
|
3
|
-
Detailed procedures for the
|
|
3
|
+
Detailed procedures for the ralph orchestration workflow. See [SKILL.md](./SKILL.md) for the top-level event loop; this file holds the per-procedure detail that would overflow the main skill file.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -13,11 +13,11 @@ Detailed procedures for the fleet orchestration workflow. See [SKILL.md](./SKILL
|
|
|
13
13
|
5. **Ensure branch + worktree exist for this parent task** (see _Feature branches and worktrees_ below), then note the worktree path — you'll pass it as `cwd` to {{TOOL:task}}.
|
|
14
14
|
6. **Fill in the prompt** — replace placeholders with:
|
|
15
15
|
- Stage from bead label (`stage:<stage>`) for `<stage>`
|
|
16
|
-
- `bd prime` output
|
|
16
|
+
- Chore bead ID and its `bd show` output for the bead specification. Do **not** inject `bd prime` output — the stage runner runs `bd prime` itself if it needs project context
|
|
17
17
|
- Parent task description from `bd show <parent-id>`
|
|
18
18
|
- For `fix` stage: `FILES_CHANGED` from the preceding stage's report (the required changes come from the fix bead's own description — read via `bd show <fix-id>`)
|
|
19
19
|
- For `verify`, `review`, `document` stages: `SUMMARY` and `FILES_CHANGED` from the preceding stage's report
|
|
20
|
-
-
|
|
20
|
+
- Log file path `.agent-cortex/ralph/ralph-<parent-id>.log` — logs are keyed by **parent** bead ID, so every stage chore of a feature appends to the same file
|
|
21
21
|
7. **Call the {{TOOL:task}} tool** with the filled prompt as `prompt` and the worktree path as `cwd`. Store the returned agentId — you need it for step 8 and for log polling.
|
|
22
22
|
8. **Map** the agent ID to the bead ID in memory for lookup on completion.
|
|
23
23
|
|
|
@@ -27,18 +27,20 @@ Detailed procedures for the fleet orchestration workflow. See [SKILL.md](./SKILL
|
|
|
27
27
|
|
|
28
28
|
For each parent task bead (`<parent-id>`):
|
|
29
29
|
|
|
30
|
-
1. Determine the parent epic (`<epic-id>`) from the task's `epic:<epic-id>` label.
|
|
31
|
-
2.
|
|
30
|
+
1. Determine the parent epic (`<epic-id>`) from the task's `epic:<epic-id>` label and count its feature task children (`bd children <epic-id>`, excluding chores). An epic with exactly one feature child is a **single-feature epic**.
|
|
31
|
+
2. **Single-feature epics (1 feature child)**: skip the epic branch entirely. Base `feature/<parent-id>` directly on `origin/main`; its HITL PR targets `main`, and no epic PR is opened later.
|
|
32
|
+
3. **Multi-feature epics (2+ feature children)**: ensure the epic branch exists (always based on the latest `origin/main`, never local `main`):
|
|
32
33
|
```bash
|
|
33
34
|
git fetch origin
|
|
34
35
|
git rev-parse --verify epic/<epic-id> >/dev/null 2>&1 || git branch epic/<epic-id> origin/main
|
|
35
36
|
```
|
|
36
|
-
|
|
37
|
+
4. Ensure feature worktree exists (base on `epic/<epic-id>` for multi-feature epics, `origin/main` for single-feature):
|
|
37
38
|
```bash
|
|
38
|
-
|
|
39
|
+
# <base> is epic/<epic-id> for multi-feature epics, origin/main for single-feature
|
|
40
|
+
git worktree add .agent-cortex/worktrees/<parent-id> -b feature/<parent-id> <base>
|
|
39
41
|
```
|
|
40
42
|
If `.agent-cortex/worktrees/<parent-id>` already exists, reuse it.
|
|
41
|
-
|
|
43
|
+
5. All chores for this parent run in `.agent-cortex/worktrees/<parent-id>`. The `feature/<parent-id>` branch is the agent branch for HITL PRs.
|
|
42
44
|
|
|
43
45
|
---
|
|
44
46
|
|
|
@@ -47,9 +49,10 @@ For each parent task bead (`<parent-id>`):
|
|
|
47
49
|
When the `document` chore for a parent task completes:
|
|
48
50
|
|
|
49
51
|
1. Close the `document` chore.
|
|
50
|
-
2. Create or update a feature PR immediately from the agent branch to the feature branch (`feature/<parent-id>` into `epic/<epic-id
|
|
52
|
+
2. Create or update a feature PR immediately from the agent branch to the feature branch (`feature/<parent-id>` into `epic/<epic-id>`; into `main` for single-feature epics):
|
|
51
53
|
```bash
|
|
52
|
-
|
|
54
|
+
# <base> is epic/<epic-id> for multi-feature epics, main for single-feature
|
|
55
|
+
gh pr create --base <base> --head feature/<parent-id> --title "[<parent-id>] <task-title>" --body "<summary>"
|
|
53
56
|
```
|
|
54
57
|
If an open PR already exists, update it instead of creating a duplicate.
|
|
55
58
|
3. Report the PR URL in chat as soon as it is created.
|
|
@@ -98,9 +101,9 @@ When a verify or review stage fails:
|
|
|
98
101
|
Run whenever polling is triggered (timer or agent completion):
|
|
99
102
|
|
|
100
103
|
1. **Query in-flight beads**: `bd list --status=in_progress --type=chore`. Extract each bead's ID and title.
|
|
101
|
-
2. For each in-flight bead, read new lines from its log file
|
|
104
|
+
2. For each in-flight bead, read new lines from its **parent's** log file — logs are keyed by **parent** bead ID, so all stages of a feature share one file. Track the next unread line number per parent in memory, starting at 1:
|
|
102
105
|
```bash
|
|
103
|
-
tail -n +<lastLine> .agent-cortex/ralph/ralph-<
|
|
106
|
+
tail -n +<lastLine> .agent-cortex/ralph/ralph-<parent-id>.log 2>/dev/null
|
|
104
107
|
```
|
|
105
108
|
3. For each bead that has new lines:
|
|
106
109
|
- **Post a chat summary** of new key events (stage transitions and notable events — not every line verbatim):
|
|
@@ -119,7 +122,7 @@ Run whenever polling is triggered (timer or agent completion):
|
|
|
119
122
|
Proceed here when no chore beads are in-flight, no `stage:*` chore beads are ready, and HITL gate beads are pending (open `lifecycle:feature-pr` beads or epics tagged `awaiting-epic-pr-merge`). Ralph stops rather than burning requests on idle polls.
|
|
120
123
|
|
|
121
124
|
1. Regenerate `.agent-cortex/ralph/progress.md` one final time — do not delete it.
|
|
122
|
-
2. For each epic whose feature beads are all closed but not yet tagged `awaiting-epic-pr-merge`, open/update an epic PR to main:
|
|
125
|
+
2. For each **multi-feature** epic whose feature beads are all closed but not yet tagged `awaiting-epic-pr-merge`, open/update an epic PR to main (skip single-feature epics — their feature branch PRs already target `main`):
|
|
123
126
|
```bash
|
|
124
127
|
gh pr create --base main --head epic/<epic-id> --title "[<epic-id>] Merge epic into main" --body "<epic summary>"
|
|
125
128
|
```
|
|
@@ -155,7 +158,7 @@ Proceed here when no chore beads are in-flight, no `stage:*` chore beads are rea
|
|
|
155
158
|
When `bd list --status=in_progress --type=chore` returns no results AND `bd ready` returns no chore beads with `stage:*` labels:
|
|
156
159
|
|
|
157
160
|
1. Regenerate `.agent-cortex/ralph/progress.md` one final time — do not delete it.
|
|
158
|
-
2. For each epic whose feature beads are all closed, open/update an epic PR to main:
|
|
161
|
+
2. For each **multi-feature** epic whose feature beads are all closed, open/update an epic PR to main (skip single-feature epics — no epic branch exists):
|
|
159
162
|
```bash
|
|
160
163
|
gh pr create --base main --head epic/<epic-id> --title "[<epic-id>] Merge epic into main" --body "<epic summary>"
|
|
161
164
|
```
|
|
@@ -188,15 +191,17 @@ When `bd list --status=in_progress --type=chore` returns no results AND `bd read
|
|
|
188
191
|
| File | Purpose |
|
|
189
192
|
|------|---------|
|
|
190
193
|
| `.agent-cortex/ralph/progress.md` | Human-readable snapshot. Regenerate: `workspace="/abs/path"; pnpm --prefix skills/workflow/run-pipeline-stage/scripts exec tsx generate-progress.ts --workspace "$workspace" > "$workspace/.agent-cortex/ralph/progress.md"`. `workspace` must be an **absolute** path — never `.` or `$(pwd)`. **Never hand-edit.** |
|
|
191
|
-
| `.agent-cortex/ralph/
|
|
194
|
+
| `.agent-cortex/ralph/state.json` | Runtime bookkeeping only: the poll-timer shellId (Copilot) and the in-flight agent-ID→bead mapping. Shape: `{ "timerShellId": null, "inflight": [ { "choreId": "...", "parentId": "...", "title": "...", "agentId": "...", "logLine": 1 } ] }`. Initialise at startup with `{ "timerShellId": null, "inflight": [] }`. Update after every dispatch and every agent completion. **Never hand-edit.** |
|
|
195
|
+
| `.agent-cortex/ralph/ralph-*.log` | Per-parent log files written by subagents — every stage chore of a feature appends to `.agent-cortex/ralph/ralph-<parent-id>.log` (e.g. `ralph-abc-123.log`). |
|
|
192
196
|
|
|
193
|
-
All
|
|
197
|
+
All task state is derived from beads; `state.json` holds only runtime bookkeeping:
|
|
194
198
|
|
|
195
199
|
| Question | How to answer |
|
|
196
200
|
|----------|---------------|
|
|
197
201
|
| What is in-flight? | `bd list --status=in_progress --type=chore` |
|
|
198
202
|
| What is ready? | `bd ready` — filter for chores with `stage:*` labels |
|
|
199
203
|
| What stage is a bead in? | Read the `stage:*` label from `bd show <id>` |
|
|
204
|
+
| Which agent-ID maps to which bead? | `inflight` entries in `.agent-cortex/ralph/state.json` |
|
|
200
205
|
| How many fix rounds? | Count chore beads with label `stage:fix` that are children of the parent task. Read `maxFixRounds` from `skills/planning/create-task/pipeline.json`. |
|
|
201
206
|
| Which features are review-gated? | Find open child task beads labelled `lifecycle:feature-pr` and `implementation-type:hitl` |
|
|
202
207
|
| Which epics are review-gated? | `bd list -l awaiting-epic-pr-merge` |
|