@jaybeeuu/agent-cortex 1.20.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/.beads/README.md +81 -0
- package/.beads/config.yaml +1 -0
- package/.beads/issues.jsonl +236 -0
- package/.beads/metadata.json +7 -0
- package/.claude-plugin/marketplace.json +16 -0
- package/.github/workflows/ci.test.ts +217 -0
- package/.github/workflows/ci.yml +35 -0
- package/.github/workflows/publish.yml +36 -0
- package/.junie/guidelines.md +87 -0
- package/.junie/mcp/mcp.json +10 -0
- package/AGENTS.md +102 -0
- package/CHANGELOG.md +705 -0
- package/README.md +209 -0
- package/agents/README.md +235 -0
- package/agents/plan.agent.md +56 -0
- package/agents/ralph-plan.agent.md +119 -0
- package/agents/ralph.agent.md +305 -0
- package/agents/strategy.agent.md +109 -0
- package/agents-native/ralph.md +193 -0
- package/bin/agent-cortex.mjs +27 -0
- package/claude/.claude-plugin/plugin.json +11 -0
- package/claude/.mcp.json +18 -0
- package/claude/agents/plan.md +56 -0
- package/claude/agents/ralph-plan.md +119 -0
- package/claude/agents/ralph.md +193 -0
- package/claude/agents/strategy.md +109 -0
- package/claude/hooks.json +23 -0
- package/claude/scripts/statusline-command.sh +124 -0
- package/docs/ideas/auto-model-selection.md +75 -0
- package/docs/ideas/improve-pi-system-prompt.md +34 -0
- package/docs/ideas/model-selector.md +40 -0
- package/docs/ideas/pi-task-memory.md +34 -0
- package/docs/ideas/qa-extension.md +43 -0
- package/docs/inspirations.md +33 -0
- package/docs/research/gas-city-research.md +256 -0
- package/docs/research/skill-design-research.md +286 -0
- package/docs/research/skill-improvements-analysis.md +117 -0
- package/docs/research/skill-patterns-research.md +24 -0
- package/docs/skills/skill-anatomy.md +149 -0
- package/docs/user-preferences.md +17 -0
- package/extensions/agent-modes/index.ts +507 -0
- package/extensions/auto-name.ts +107 -0
- package/extensions/context-loader.md +35 -0
- package/extensions/context-loader.ts +65 -0
- package/extensions/lib/tiny-model.ts +212 -0
- package/extensions/notify/index.ts +293 -0
- package/extensions/session-start.ts +44 -0
- package/extensions/skill-stats/README.md +74 -0
- package/extensions/skill-stats/context-loader.test.ts +107 -0
- package/extensions/skill-stats/discover.ts +119 -0
- package/extensions/skill-stats/format.ts +13 -0
- package/extensions/skill-stats/index.test.ts +452 -0
- package/extensions/skill-stats/index.ts +222 -0
- package/extensions/skill-stats/package.json +19 -0
- package/extensions/skill-stats/pnpm-lock.yaml +329 -0
- package/extensions/skill-stats/record.ts +48 -0
- package/extensions/skill-stats/store.ts +104 -0
- package/extensions/skill-stats/tsconfig.json +12 -0
- package/extensions/subagent/README.md +175 -0
- package/extensions/subagent/agents/planner.md +37 -0
- package/extensions/subagent/agents/reviewer.md +35 -0
- package/extensions/subagent/agents/scout.md +50 -0
- package/extensions/subagent/agents/worker.md +24 -0
- package/extensions/subagent/agents.ts +126 -0
- package/extensions/subagent/index.ts +1138 -0
- package/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/extensions/subagent/prompts/implement.md +10 -0
- package/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/hooks.json +10 -0
- package/lib/cli.mjs +37 -0
- package/package.json +39 -0
- package/pi/keybindings.json +3 -0
- package/pi/settings.json +29 -0
- package/plugin.json +35 -0
- package/pnpm-workspace.yaml +7 -0
- package/scripts/build-claude-agents.mjs +179 -0
- package/scripts/install-instructions.sh +82 -0
- package/skills/engineering/design-an-interface/SKILL.md +94 -0
- package/skills/engineering/grill-with-docs/SKILL.md +88 -0
- package/skills/engineering/improve-codebase-architecture/REFERENCE.md +78 -0
- package/skills/engineering/improve-codebase-architecture/SKILL.md +81 -0
- package/skills/engineering/tdd/SKILL.md +150 -0
- package/skills/engineering/tdd/deep-modules.md +33 -0
- package/skills/engineering/tdd/interface-design.md +31 -0
- package/skills/engineering/tdd/mocking.md +59 -0
- package/skills/engineering/tdd/refactoring.md +10 -0
- package/skills/engineering/tdd/tests.md +61 -0
- package/skills/engineering/technical-direction/SKILL.md +86 -0
- package/skills/planning/classify-bead/SKILL.md +67 -0
- package/skills/planning/create-task/SKILL.md +96 -0
- package/skills/planning/create-task/pipeline.json +33 -0
- package/skills/planning/create-task/scripts/create-chores.ts +112 -0
- package/skills/planning/create-task/scripts/package.json +14 -0
- package/skills/planning/create-task/scripts/pnpm-lock.yaml +342 -0
- package/skills/planning/create-task/scripts/tsconfig.json +12 -0
- package/skills/planning/create-task/templates/code.md +40 -0
- package/skills/planning/create-task/templates/document.md +40 -0
- package/skills/planning/create-task/templates/fix.md +27 -0
- package/skills/planning/create-task/templates/review.md +36 -0
- package/skills/planning/create-task/templates/verify.md +43 -0
- package/skills/planning/prd-to-tasks/SKILL.md +227 -0
- package/skills/planning/record-idea/SKILL.md +62 -0
- package/skills/planning/record-idea/scripts/new-idea.sh +89 -0
- package/skills/planning/request-refactor-plan/SKILL.md +73 -0
- package/skills/planning/write-a-prd/SKILL.md +74 -0
- package/skills/planning/write-a-ticket/SKILL.md +97 -0
- package/skills/productivity/bd-tool/SKILL.md +90 -0
- package/skills/productivity/grill-me/SKILL.md +10 -0
- package/skills/productivity/handoff/SKILL.md +15 -0
- package/skills/productivity/init-beads/SKILL.md +93 -0
- package/skills/productivity/teach/GLOSSARY-FORMAT.md +35 -0
- package/skills/productivity/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/skills/productivity/teach/MISSION-FORMAT.md +31 -0
- package/skills/productivity/teach/RESOURCES-FORMAT.md +32 -0
- package/skills/productivity/teach/SKILL.md +109 -0
- package/skills/productivity/validate-agent-dir/scripts/package.json +15 -0
- package/skills/productivity/validate-agent-dir/scripts/pnpm-lock.yaml +329 -0
- package/skills/productivity/validate-agent-dir/scripts/pnpm-workspace.yaml +2 -0
- package/skills/productivity/validate-agent-dir/scripts/tsconfig.json +19 -0
- package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.test.ts +317 -0
- package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.ts +127 -0
- package/skills/productivity/write-a-skill/SKILL.md +74 -0
- package/skills/review/maintain-agent-docs/REFERENCE.md +246 -0
- package/skills/review/maintain-agent-docs/SKILL.md +83 -0
- package/skills/review/refactor-skill/EXAMPLES.md +20 -0
- package/skills/review/refactor-skill/SKILL.md +148 -0
- package/skills/review/review-security/SKILL.md +107 -0
- package/skills/review/review-security/scripts/install-gitleaks.sh +43 -0
- package/skills/style/style-code/REFERENCE.md +38 -0
- package/skills/style/style-code/SKILL.md +113 -0
- package/skills/style/style-comms/SKILL.md +93 -0
- package/skills/style/style-documentation/SKILL.md +112 -0
- package/skills/style/style-tests/SKILL.md +97 -0
- package/skills/workflow/git-workflow/SKILL.md +85 -0
- package/skills/workflow/hitl-collab/SKILL.md +29 -0
- package/skills/workflow/plan/SKILL.md +272 -0
- package/skills/workflow/ralph/REFERENCE.md +202 -0
- package/skills/workflow/ralph/SKILL.md +105 -0
- package/skills/workflow/run-pipeline-stage/SKILL.md +151 -0
- package/skills/workflow/run-pipeline-stage/playbooks/code.md +17 -0
- package/skills/workflow/run-pipeline-stage/playbooks/document.md +18 -0
- package/skills/workflow/run-pipeline-stage/playbooks/fix.md +17 -0
- package/skills/workflow/run-pipeline-stage/playbooks/review.md +19 -0
- package/skills/workflow/run-pipeline-stage/playbooks/verify.md +14 -0
- package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +20 -0
- package/skills/workflow/run-pipeline-stage/scripts/generate-progress.test.ts +783 -0
- package/skills/workflow/run-pipeline-stage/scripts/generate-progress.ts +586 -0
- package/skills/workflow/run-pipeline-stage/scripts/package.json +15 -0
- package/skills/workflow/run-pipeline-stage/scripts/pnpm-lock.yaml +342 -0
- package/skills/workflow/run-pipeline-stage/scripts/pnpm-workspace.yaml +2 -0
- package/skills/workflow/run-pipeline-stage/scripts/tsconfig.json +12 -0
- package/skills/workflow/using-agent-skills/SKILL.md +109 -0
- package/skills/workflow/using-agent-skills/scripts/validate-skill-structure.test.ts +73 -0
- package/test/cli.test.mjs +149 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Worker implements, reviewer reviews, worker applies feedback
|
|
3
|
+
---
|
|
4
|
+
Use the subagent tool with the chain parameter to execute this workflow:
|
|
5
|
+
|
|
6
|
+
1. First, use the "worker" agent to implement: $@
|
|
7
|
+
2. Then, use the "reviewer" agent to review the implementation from the previous step (use {previous} placeholder)
|
|
8
|
+
3. Finally, use the "worker" agent to apply the feedback from the review (use {previous} placeholder)
|
|
9
|
+
|
|
10
|
+
Execute this as a chain, passing output between steps via {previous}.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Full implementation workflow - scout gathers context, planner creates plan, worker implements
|
|
3
|
+
---
|
|
4
|
+
Use the subagent tool with the chain parameter to execute this workflow:
|
|
5
|
+
|
|
6
|
+
1. First, use the "scout" agent to find all code relevant to: $@
|
|
7
|
+
2. Then, use the "planner" agent to create an implementation plan for "$@" using the context from the previous step (use {previous} placeholder)
|
|
8
|
+
3. Finally, use the "worker" agent to implement the plan from the previous step (use {previous} placeholder)
|
|
9
|
+
|
|
10
|
+
Execute this as a chain, passing output between steps via {previous}.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scout gathers context, planner creates implementation plan (no implementation)
|
|
3
|
+
---
|
|
4
|
+
Use the subagent tool with the chain parameter to execute this workflow:
|
|
5
|
+
|
|
6
|
+
1. First, use the "scout" agent to find all code relevant to: $@
|
|
7
|
+
2. Then, use the "planner" agent to create an implementation plan for "$@" using the context from the previous step (use {previous} placeholder)
|
|
8
|
+
|
|
9
|
+
Execute this as a chain, passing output between steps via {previous}. Do NOT implement - just return the plan.
|
package/hooks.json
ADDED
package/lib/cli.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const SUPPORTED_HARNESSES = ["copilot", "claude", "pi"];
|
|
2
|
+
|
|
3
|
+
export function parseArgs(argv) {
|
|
4
|
+
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
5
|
+
return { command: "help" };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const [command, ...rest] = argv;
|
|
9
|
+
|
|
10
|
+
if (command === "install") {
|
|
11
|
+
const harness = rest[0] ?? null;
|
|
12
|
+
return { command: "install", harness };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return { command: "unknown", name: command };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function buildHelpText() {
|
|
19
|
+
return `Usage: agent-cortex <command> [options]
|
|
20
|
+
|
|
21
|
+
Commands:
|
|
22
|
+
install <harness> Install agent-cortex for a harness
|
|
23
|
+
Supported harnesses: ${SUPPORTED_HARNESSES.join(", ")}
|
|
24
|
+
--help, -h Show this help text`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function validateHarness(harness) {
|
|
28
|
+
if (harness === null) {
|
|
29
|
+
return { ok: false, error: "Missing harness argument. Supported harnesses: copilot, claude, pi" };
|
|
30
|
+
}
|
|
31
|
+
if (!SUPPORTED_HARNESSES.includes(harness)) {
|
|
32
|
+
return { ok: false, error: `Unknown harness "${harness}". Supported harnesses: ${SUPPORTED_HARNESSES.join(", ")}` };
|
|
33
|
+
}
|
|
34
|
+
return { ok: true };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { SUPPORTED_HARNESSES };
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jaybeeuu/agent-cortex",
|
|
3
|
+
"version": "1.20.0",
|
|
4
|
+
"description": "Personal PI package with custom agents, skills, and extensions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/jaybeeuu/agent-cortex"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"agent-cortex": "./bin/agent-cortex.mjs"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"tsx": "^4.0.0",
|
|
21
|
+
"yaml": "^2.0.0"
|
|
22
|
+
},
|
|
23
|
+
"pi": {
|
|
24
|
+
"extensions": [
|
|
25
|
+
"./extensions"
|
|
26
|
+
],
|
|
27
|
+
"skills": [
|
|
28
|
+
"./skills"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "echo 'Build complete — no compilation needed for PI package'",
|
|
33
|
+
"lint": "pnpm typecheck",
|
|
34
|
+
"test": "pnpm -r test",
|
|
35
|
+
"typecheck": "pnpm -r typecheck",
|
|
36
|
+
"build:claude": "node scripts/build-claude-agents.mjs",
|
|
37
|
+
"postinstall": "bash scripts/install-instructions.sh"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/pi/settings.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tinyModel": {
|
|
3
|
+
"model": "opencode/mimo-v2.5-free",
|
|
4
|
+
"maxNameLength": 40,
|
|
5
|
+
"maxSummaryLength": 100
|
|
6
|
+
},
|
|
7
|
+
"lastChangelogVersion": "0.83.0",
|
|
8
|
+
"packages": [
|
|
9
|
+
"../../src/agent-cortex",
|
|
10
|
+
"npm:pi-web-access@0.10.7",
|
|
11
|
+
"npm:@getpipher/vision",
|
|
12
|
+
"npm:@hypabolic/pi-hypa",
|
|
13
|
+
"npm:context-mode"
|
|
14
|
+
],
|
|
15
|
+
"defaultProvider": "opencode-go",
|
|
16
|
+
"defaultModel": "qwen3.7-max",
|
|
17
|
+
"theme": "dark",
|
|
18
|
+
"defaultThinkingLevel": "high",
|
|
19
|
+
"enabledModels": [
|
|
20
|
+
"opencode/nemotron-3-ultra-free",
|
|
21
|
+
"opencode-go/qwen3.7-max",
|
|
22
|
+
"opencode/kimi-k2.7-code",
|
|
23
|
+
"opencode/mimo-v2.5-free",
|
|
24
|
+
"opencode-go/mimo-v2.5",
|
|
25
|
+
"opencode/deepseek-v4-flash-free",
|
|
26
|
+
"opencode-go/deepseek-v4-flash",
|
|
27
|
+
"opencode/big-pickle"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-cortex",
|
|
3
|
+
"description": "Personal Copilot CLI plugin with custom agents and skills",
|
|
4
|
+
"version": "1.36.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "jaybeeuu"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": "https://github.com/jaybeeuu/agent-cortex",
|
|
10
|
+
"bin": "bin/agent-cortex.mjs",
|
|
11
|
+
"agents": "agents/",
|
|
12
|
+
"skills": "skills/",
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"context7": {
|
|
15
|
+
"type": "stdio",
|
|
16
|
+
"command": "npx",
|
|
17
|
+
"args": [
|
|
18
|
+
"-y",
|
|
19
|
+
"@upstash/context7-mcp@latest"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"github": {
|
|
23
|
+
"type": "stdio",
|
|
24
|
+
"command": "pnpm",
|
|
25
|
+
"args": [
|
|
26
|
+
"dlx",
|
|
27
|
+
"@modelcontextprotocol/server-github"
|
|
28
|
+
],
|
|
29
|
+
"tools": [
|
|
30
|
+
"*"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"hooks": "hooks.json"
|
|
35
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Builds the self-contained Claude Code plugin subtree at claude/ from the canonical
|
|
2
|
+
// Copilot sources. The Copilot files (agents/*.agent.md) and the grouped skills/ tree
|
|
3
|
+
// stay the single source of truth; the claude/ subtree is generated and committed.
|
|
4
|
+
// CI runs this and checks `git diff --exit-code claude/` to guarantee it is never stale.
|
|
5
|
+
//
|
|
6
|
+
// claude/agents/*.md generated from agents/*.agent.md (frontmatter + tools converted)
|
|
7
|
+
// claude/skills/<name> symlinks to the grouped skills/<group>/<name> dirs (single source)
|
|
8
|
+
//
|
|
9
|
+
// Claude only loads agents from the default ./agents/ dir of the plugin root (custom
|
|
10
|
+
// `agents` manifest paths are ignored), so the plugin root is claude/ — isolating it
|
|
11
|
+
// from the Copilot .agent.md files, which would otherwise load as broken agents.
|
|
12
|
+
//
|
|
13
|
+
// Run: pnpm build:claude (node scripts/build-claude-agents.mjs)
|
|
14
|
+
// Zero dependencies so it runs on the CI Node (20) and local Node alike.
|
|
15
|
+
|
|
16
|
+
import { readdirSync, readFileSync, writeFileSync, mkdirSync, rmSync, symlinkSync, statSync, copyFileSync, existsSync } from "node:fs";
|
|
17
|
+
import { join, dirname, relative } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
|
|
20
|
+
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
21
|
+
const AGENT_SRC = join(ROOT, "agents");
|
|
22
|
+
const NATIVE_SRC = join(ROOT, "agents-native");
|
|
23
|
+
const SKILL_SRC = join(ROOT, "skills");
|
|
24
|
+
const AGENT_OUT = join(ROOT, "claude", "agents");
|
|
25
|
+
const SKILL_OUT = join(ROOT, "claude", "skills");
|
|
26
|
+
|
|
27
|
+
// Copilot tool name -> Claude tool name. `null` = drop (no Claude equivalent).
|
|
28
|
+
const TOOL_MAP = {
|
|
29
|
+
bash: "Bash",
|
|
30
|
+
view: "Read",
|
|
31
|
+
edit: "Edit",
|
|
32
|
+
create: "Write",
|
|
33
|
+
grep: "Grep",
|
|
34
|
+
rg: "Grep",
|
|
35
|
+
glob: "Glob",
|
|
36
|
+
ask_user: "AskUserQuestion",
|
|
37
|
+
web_fetch: "WebFetch",
|
|
38
|
+
skill: "Skill",
|
|
39
|
+
task: "Task",
|
|
40
|
+
read_agent: null, // Claude's Task returns results inline; no separate read step.
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Agents NOT transformed from the Copilot source. `ralph` is authored natively for Claude
|
|
44
|
+
// instead (agents-native/ralph.md) — its event-driven orchestration can't be produced by
|
|
45
|
+
// token substitution from the poll-loop Copilot source.
|
|
46
|
+
const DEFER = new Set(["ralph"]);
|
|
47
|
+
|
|
48
|
+
// Ralph-coupled Copilot skills that don't apply to the lean Claude Ralph (and carry dead
|
|
49
|
+
// ~/.copilot orchestration paths). Not symlinked into the Claude plugin.
|
|
50
|
+
const SKILL_EXCLUDE = new Set(["ralph", "run-pipeline-stage"]);
|
|
51
|
+
|
|
52
|
+
const COPILOT_PLUGIN_ROOT = "~/.copilot/installed-plugins/_direct/agent-cortex";
|
|
53
|
+
const CLAUDE_PLUGIN_ROOT = "${CLAUDE_PLUGIN_ROOT}";
|
|
54
|
+
const NAME_PREFIX = "agent-cortex:";
|
|
55
|
+
|
|
56
|
+
function parseFrontmatter(text, file) {
|
|
57
|
+
const m = text.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);
|
|
58
|
+
if (!m) throw new Error(`${file}: no YAML frontmatter found`);
|
|
59
|
+
return { fm: m[1], body: text.slice(m[0].length) };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function scalarLine(fm, key) {
|
|
63
|
+
const m = fm.match(new RegExp(`^${key}:[ \\t]*(.+?)[ \\t]*$`, "m"));
|
|
64
|
+
return m ? m[1] : undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function stripQuotes(s) {
|
|
68
|
+
return s === undefined ? undefined : s.replace(/^["']([\s\S]*)["']$/, "$1");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function mapTools(fm, file) {
|
|
72
|
+
const raw = scalarLine(fm, "tools");
|
|
73
|
+
if (!raw) throw new Error(`${file}: no tools field`);
|
|
74
|
+
let list;
|
|
75
|
+
try {
|
|
76
|
+
list = JSON.parse(raw);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error(`${file}: tools is not a JSON array: ${raw}`);
|
|
79
|
+
}
|
|
80
|
+
const out = [];
|
|
81
|
+
for (const t of list) {
|
|
82
|
+
if (!(t in TOOL_MAP)) throw new Error(`${file}: unknown tool "${t}" — extend TOOL_MAP`);
|
|
83
|
+
const mapped = TOOL_MAP[t];
|
|
84
|
+
if (mapped && !out.includes(mapped)) out.push(mapped);
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Rewrite harness-specific tokens in the prose body: exact backticked tool names and
|
|
90
|
+
// the hardcoded Copilot plugin path. Only touches `\`token\`` so shell snippets like
|
|
91
|
+
// `bd create` inside code fences are untouched.
|
|
92
|
+
function transformBody(body) {
|
|
93
|
+
let out = body;
|
|
94
|
+
for (const [copilot, claude] of Object.entries(TOOL_MAP)) {
|
|
95
|
+
if (claude) out = out.split("`" + copilot + "`").join("`" + claude + "`");
|
|
96
|
+
}
|
|
97
|
+
return out.split(COPILOT_PLUGIN_ROOT).join(CLAUDE_PLUGIN_ROOT);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function buildAgents() {
|
|
101
|
+
rmSync(AGENT_OUT, { recursive: true, force: true });
|
|
102
|
+
mkdirSync(AGENT_OUT, { recursive: true });
|
|
103
|
+
|
|
104
|
+
const written = [];
|
|
105
|
+
const skipped = [];
|
|
106
|
+
for (const file of readdirSync(AGENT_SRC).filter((f) => f.endsWith(".agent.md")).sort()) {
|
|
107
|
+
const { fm, body } = parseFrontmatter(readFileSync(join(AGENT_SRC, file), "utf8"), file);
|
|
108
|
+
|
|
109
|
+
const rawName = stripQuotes(scalarLine(fm, "name"));
|
|
110
|
+
if (!rawName) throw new Error(`${file}: no name field`);
|
|
111
|
+
const slug = rawName.startsWith(NAME_PREFIX) ? rawName.slice(NAME_PREFIX.length) : rawName;
|
|
112
|
+
if (DEFER.has(slug)) {
|
|
113
|
+
skipped.push(slug);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const description = scalarLine(fm, "description");
|
|
118
|
+
if (!description) throw new Error(`${file}: no description field`);
|
|
119
|
+
|
|
120
|
+
const header =
|
|
121
|
+
`---\n` +
|
|
122
|
+
`# GENERATED from agents/${file} by scripts/build-claude-agents.mjs — DO NOT EDIT.\n` +
|
|
123
|
+
`name: ${slug}\n` +
|
|
124
|
+
`description: ${description}\n` +
|
|
125
|
+
`tools: ${mapTools(fm, file).join(", ")}\n` +
|
|
126
|
+
`---\n`;
|
|
127
|
+
const out = `${header}\n${transformBody(body).replace(/^\r?\n+/, "").replace(/\s*$/, "")}\n`;
|
|
128
|
+
writeFileSync(join(AGENT_OUT, `${slug}.md`), out);
|
|
129
|
+
written.push(slug);
|
|
130
|
+
}
|
|
131
|
+
console.log(`Generated ${written.length} Claude agent(s): ${written.join(", ")}`);
|
|
132
|
+
if (skipped.length) console.log(`Skipped Copilot source(s): ${skipped.join(", ")}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Copy hand-authored Claude-native agents into claude/agents/ verbatim, alongside the
|
|
136
|
+
// generated ones. These have no Copilot source (their bodies differ structurally per harness).
|
|
137
|
+
function copyNativeAgents() {
|
|
138
|
+
if (!existsSync(NATIVE_SRC)) return;
|
|
139
|
+
const copied = [];
|
|
140
|
+
for (const file of readdirSync(NATIVE_SRC).filter((f) => f.endsWith(".md")).sort()) {
|
|
141
|
+
copyFileSync(join(NATIVE_SRC, file), join(AGENT_OUT, file));
|
|
142
|
+
copied.push(file.replace(/\.md$/, ""));
|
|
143
|
+
}
|
|
144
|
+
if (copied.length) console.log(`Copied ${copied.length} native Claude agent(s): ${copied.join(", ")}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Symlink each grouped skill (skills/<group>/<name>/) into the flat claude/skills/ dir
|
|
148
|
+
// so Claude's one-level-deep skill scan discovers them without duplicating content.
|
|
149
|
+
function buildSkills() {
|
|
150
|
+
rmSync(SKILL_OUT, { recursive: true, force: true });
|
|
151
|
+
mkdirSync(SKILL_OUT, { recursive: true });
|
|
152
|
+
|
|
153
|
+
const byName = new Map();
|
|
154
|
+
for (const group of readdirSync(SKILL_SRC).sort()) {
|
|
155
|
+
const groupDir = join(SKILL_SRC, group);
|
|
156
|
+
if (!statSync(groupDir).isDirectory()) continue;
|
|
157
|
+
for (const name of readdirSync(groupDir).sort()) {
|
|
158
|
+
const skillDir = join(groupDir, name);
|
|
159
|
+
let hasSkill;
|
|
160
|
+
try {
|
|
161
|
+
hasSkill = statSync(join(skillDir, "SKILL.md")).isFile();
|
|
162
|
+
} catch {
|
|
163
|
+
hasSkill = false;
|
|
164
|
+
}
|
|
165
|
+
if (!hasSkill) continue;
|
|
166
|
+
if (SKILL_EXCLUDE.has(name)) continue;
|
|
167
|
+
if (byName.has(name)) {
|
|
168
|
+
throw new Error(`duplicate skill name "${name}" (${byName.get(name)} and ${group}) — names must be unique when flattened`);
|
|
169
|
+
}
|
|
170
|
+
byName.set(name, group);
|
|
171
|
+
symlinkSync(relative(SKILL_OUT, skillDir), join(SKILL_OUT, name));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
console.log(`Linked ${byName.size} skill(s) into claude/skills/`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
buildAgents();
|
|
178
|
+
copyNativeAgents();
|
|
179
|
+
buildSkills();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs ~/.copilot/copilot-instructions.md with proactive skill directives.
|
|
3
|
+
# Run after cloning this plugin: pnpm install (or bash scripts/install-instructions.sh)
|
|
4
|
+
# Safe to re-run — replaces the agent-cortex section only.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
INSTRUCTIONS_FILE="$HOME/.copilot/copilot-instructions.md"
|
|
9
|
+
MARKER_START="<!-- agent-cortex:start -->"
|
|
10
|
+
MARKER_END="<!-- agent-cortex:end -->"
|
|
11
|
+
|
|
12
|
+
BLOCK="$MARKER_START
|
|
13
|
+
<!-- This block is managed by agent-cortex. Manual edits inside will be overwritten. -->
|
|
14
|
+
|
|
15
|
+
## Proactive skill use (agent-cortex plugin)
|
|
16
|
+
|
|
17
|
+
You have a set of custom skills available. Apply them automatically whenever they are relevant — the user should not have to invoke them by name.
|
|
18
|
+
|
|
19
|
+
### Code & tests
|
|
20
|
+
|
|
21
|
+
- Apply **style-code** whenever writing, editing, or reviewing code. It defines naming, module boundaries, and architectural conventions.
|
|
22
|
+
- Apply **style-tests** whenever writing, editing, or reviewing tests. It defines assertion strategy, mock discipline, and what to test.
|
|
23
|
+
- Apply **style-comms** whenever writing external-facing communication: tickets, RFCs, PRDs, proposals, or reports.
|
|
24
|
+
- Apply **style-documentation** whenever deciding what to document or reviewing existing docs.
|
|
25
|
+
- Use **tdd** (red-green-refactor loop) whenever building a new feature or fixing a bug where correctness matters.
|
|
26
|
+
- Run **review-security** before committing any changes that touch secrets, auth, or credentials.
|
|
27
|
+
|
|
28
|
+
### Planning & design
|
|
29
|
+
|
|
30
|
+
- Use **write-a-prd** when the user wants to plan a new feature or product requirement.
|
|
31
|
+
- Use **prd-to-tasks** after a PRD is approved to break it into phased epics and task beads.
|
|
32
|
+
- Use **create-task** when creating a new trackable task bead.
|
|
33
|
+
- Use **record-idea** when the user shares an early-stage idea that is not yet ready to implement.
|
|
34
|
+
- Use **request-refactor-plan** when the user wants to plan a refactor with safe incremental commits.
|
|
35
|
+
- Use **write-a-ticket** when writing a ticket for an external issue tracker (e.g. Jira).
|
|
36
|
+
- Use **design-an-interface** when the user wants to explore multiple API or module designs.
|
|
37
|
+
- Use **technical-direction** when evaluating architecture or technology choices with tradeoff analysis.
|
|
38
|
+
- Use **grill-me** or **grill-with-docs** when the user wants to stress-test a plan or design.
|
|
39
|
+
- Use **improve-codebase-architecture** when the user wants to find architectural improvement opportunities.
|
|
40
|
+
|
|
41
|
+
### Task execution
|
|
42
|
+
|
|
43
|
+
- Use **bd-tool** whenever the user mentions beads, bd, tasks, or asks what work is available.
|
|
44
|
+
- Use **ralph** to run all pending beads end-to-end with review gates.
|
|
45
|
+
- Use **run-pipeline-stage** to work through individual pipeline stages inline.
|
|
46
|
+
- Use **hitl-collab** when a task requires human review, manual steps, or a PR handoff.
|
|
47
|
+
- Use **classify-bead** when a bead is missing its implementation-type label.
|
|
48
|
+
|
|
49
|
+
### Repo & plugin maintenance
|
|
50
|
+
|
|
51
|
+
- Use **maintain-agent-docs** when reviewing or updating AGENTS.md or agent-consumed docs.
|
|
52
|
+
- Use **refactor-skill** when restructuring or reviewing an existing skill.
|
|
53
|
+
- Use **write-a-skill** when creating a new skill.
|
|
54
|
+
- Use **init-beads** when setting up the bd task-tracker in a new project.
|
|
55
|
+
|
|
56
|
+
$MARKER_END"
|
|
57
|
+
|
|
58
|
+
mkdir -p "$(dirname "$INSTRUCTIONS_FILE")"
|
|
59
|
+
|
|
60
|
+
if [ ! -f "$INSTRUCTIONS_FILE" ]; then
|
|
61
|
+
printf '%s\n' "$BLOCK" > "$INSTRUCTIONS_FILE"
|
|
62
|
+
echo "✓ Created $INSTRUCTIONS_FILE"
|
|
63
|
+
elif grep -qF "$MARKER_START" "$INSTRUCTIONS_FILE"; then
|
|
64
|
+
# Write replacement block to a temp file so awk can read it with getline
|
|
65
|
+
BLOCK_FILE=$(mktemp)
|
|
66
|
+
printf '%s\n' "$BLOCK" > "$BLOCK_FILE"
|
|
67
|
+
awk -v start="$MARKER_START" -v end="$MARKER_END" -v blockfile="$BLOCK_FILE" '
|
|
68
|
+
$0 == start {
|
|
69
|
+
while ((getline line < blockfile) > 0) print line
|
|
70
|
+
close(blockfile)
|
|
71
|
+
skip=1; next
|
|
72
|
+
}
|
|
73
|
+
$0 == end { skip=0; next }
|
|
74
|
+
!skip { print }
|
|
75
|
+
' "$INSTRUCTIONS_FILE" > "${INSTRUCTIONS_FILE}.tmp"
|
|
76
|
+
mv "${INSTRUCTIONS_FILE}.tmp" "$INSTRUCTIONS_FILE"
|
|
77
|
+
rm -f "$BLOCK_FILE"
|
|
78
|
+
echo "✓ Updated agent-cortex section in $INSTRUCTIONS_FILE"
|
|
79
|
+
else
|
|
80
|
+
printf '\n%s\n' "$BLOCK" >> "$INSTRUCTIONS_FILE"
|
|
81
|
+
echo "✓ Appended agent-cortex section to $INSTRUCTIONS_FILE"
|
|
82
|
+
fi
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-an-interface
|
|
3
|
+
description: Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Design an Interface
|
|
7
|
+
|
|
8
|
+
Based on "Design It Twice" from "A Philosophy of Software Design": your first idea is unlikely to be the best. Generate multiple radically different designs, then compare.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
### 1. Gather Requirements
|
|
13
|
+
|
|
14
|
+
Before designing, understand:
|
|
15
|
+
|
|
16
|
+
- [ ] What problem does this module solve?
|
|
17
|
+
- [ ] Who are the callers? (other modules, external users, tests)
|
|
18
|
+
- [ ] What are the key operations?
|
|
19
|
+
- [ ] Any constraints? (performance, compatibility, existing patterns)
|
|
20
|
+
- [ ] What should be hidden inside vs exposed?
|
|
21
|
+
|
|
22
|
+
Ask: "What does this module need to do? Who will use it?"
|
|
23
|
+
|
|
24
|
+
### 2. Generate Designs (Parallel Sub-Agents)
|
|
25
|
+
|
|
26
|
+
Spawn 3+ sub-agents simultaneously using Task tool. Each must produce a **radically different** approach.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Prompt template for each sub-agent:
|
|
30
|
+
|
|
31
|
+
Design an interface for: [module description]
|
|
32
|
+
|
|
33
|
+
Requirements: [gathered requirements]
|
|
34
|
+
|
|
35
|
+
Constraints for this design: [assign a different constraint to each agent]
|
|
36
|
+
- Agent 1: "Minimize method count - aim for 1-3 methods max"
|
|
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
|
+
Output format:
|
|
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
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Present Designs
|
|
49
|
+
|
|
50
|
+
Show each design with:
|
|
51
|
+
|
|
52
|
+
1. **Interface signature** - types, methods, params
|
|
53
|
+
2. **Usage examples** - how callers actually use it in practice
|
|
54
|
+
3. **What it hides** - complexity kept internal
|
|
55
|
+
|
|
56
|
+
Present designs sequentially so user can absorb each approach before comparison.
|
|
57
|
+
|
|
58
|
+
### 4. Compare Designs
|
|
59
|
+
|
|
60
|
+
After showing all designs, compare them on:
|
|
61
|
+
|
|
62
|
+
- **Interface simplicity**: fewer methods, simpler params
|
|
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**
|
|
67
|
+
|
|
68
|
+
Discuss trade-offs in prose, not tables. Highlight where designs diverge most.
|
|
69
|
+
|
|
70
|
+
### 5. Synthesize
|
|
71
|
+
|
|
72
|
+
Often the best design combines insights from multiple options. Ask:
|
|
73
|
+
|
|
74
|
+
- "Which design best fits your primary use case?"
|
|
75
|
+
- "Any elements from other designs worth incorporating?"
|
|
76
|
+
|
|
77
|
+
## Evaluation Criteria
|
|
78
|
+
|
|
79
|
+
From "A Philosophy of Software Design":
|
|
80
|
+
|
|
81
|
+
**Interface simplicity**: Fewer methods, simpler params = easier to learn and use correctly.
|
|
82
|
+
|
|
83
|
+
**General-purpose**: Can handle future use cases without changes. But beware over-generalization.
|
|
84
|
+
|
|
85
|
+
**Implementation efficiency**: Does interface shape allow efficient implementation? Or force awkward internals?
|
|
86
|
+
|
|
87
|
+
**Depth**: Small interface hiding significant complexity = deep module (good). Large interface with thin implementation = shallow module (avoid).
|
|
88
|
+
|
|
89
|
+
## Anti-Patterns
|
|
90
|
+
|
|
91
|
+
- Don't let sub-agents produce similar designs - enforce radical difference
|
|
92
|
+
- Don't skip comparison - the value is in contrast
|
|
93
|
+
- Don't implement - this is purely about interface shape
|
|
94
|
+
- Don't evaluate based on implementation effort
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grill-with-docs
|
|
3
|
+
description: Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<what-to-do>
|
|
7
|
+
|
|
8
|
+
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
|
9
|
+
|
|
10
|
+
Ask the questions one at a time, waiting for feedback on each question before continuing.
|
|
11
|
+
|
|
12
|
+
If a question can be answered by exploring the codebase, explore the codebase instead.
|
|
13
|
+
|
|
14
|
+
</what-to-do>
|
|
15
|
+
|
|
16
|
+
<supporting-info>
|
|
17
|
+
|
|
18
|
+
## Domain awareness
|
|
19
|
+
|
|
20
|
+
During codebase exploration, also look for existing documentation:
|
|
21
|
+
|
|
22
|
+
### File structure
|
|
23
|
+
|
|
24
|
+
Most repos have a single context:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
/
|
|
28
|
+
├── CONTEXT.md
|
|
29
|
+
├── docs/
|
|
30
|
+
│ └── adr/
|
|
31
|
+
│ ├── 0001-event-sourced-orders.md
|
|
32
|
+
│ └── 0002-postgres-for-write-model.md
|
|
33
|
+
└── src/
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
/
|
|
40
|
+
├── CONTEXT-MAP.md
|
|
41
|
+
├── docs/
|
|
42
|
+
│ └── adr/ ← system-wide decisions
|
|
43
|
+
├── src/
|
|
44
|
+
│ ├── ordering/
|
|
45
|
+
│ │ ├── CONTEXT.md
|
|
46
|
+
│ │ └── docs/adr/ ← context-specific decisions
|
|
47
|
+
│ └── billing/
|
|
48
|
+
│ ├── CONTEXT.md
|
|
49
|
+
│ └── docs/adr/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
|
|
53
|
+
|
|
54
|
+
## During the session
|
|
55
|
+
|
|
56
|
+
### Challenge against the glossary
|
|
57
|
+
|
|
58
|
+
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
|
|
59
|
+
|
|
60
|
+
### Sharpen fuzzy language
|
|
61
|
+
|
|
62
|
+
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account' — do you mean the Customer or the User? Those are different things."
|
|
63
|
+
|
|
64
|
+
### Discuss concrete scenarios
|
|
65
|
+
|
|
66
|
+
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
|
|
67
|
+
|
|
68
|
+
### Cross-reference with code
|
|
69
|
+
|
|
70
|
+
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible — which is right?"
|
|
71
|
+
|
|
72
|
+
### Update CONTEXT.md inline
|
|
73
|
+
|
|
74
|
+
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up — capture them as they happen. Use the format in [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md).
|
|
75
|
+
|
|
76
|
+
`CONTEXT.md` should be totally devoid of implementation details. Do not treat `CONTEXT.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
|
|
77
|
+
|
|
78
|
+
### Offer ADRs sparingly
|
|
79
|
+
|
|
80
|
+
Only offer to create an ADR when all three are true:
|
|
81
|
+
|
|
82
|
+
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
|
83
|
+
2. **Surprising without context** — a future reader will wonder "why did they do it this way?"
|
|
84
|
+
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
|
85
|
+
|
|
86
|
+
If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
|
|
87
|
+
|
|
88
|
+
</supporting-info>
|