@soleri/cli 1.7.0 → 1.9.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/code-reviewer/.claude/hookify.focus-ring-required.local.md +21 -0
- package/code-reviewer/.claude/hookify.no-ai-attribution.local.md +18 -0
- package/code-reviewer/.claude/hookify.no-any-types.local.md +18 -0
- package/code-reviewer/.claude/hookify.no-console-log.local.md +21 -0
- package/code-reviewer/.claude/hookify.no-important.local.md +18 -0
- package/code-reviewer/.claude/hookify.no-inline-styles.local.md +21 -0
- package/code-reviewer/.claude/hookify.semantic-html.local.md +18 -0
- package/code-reviewer/.claude/hookify.ux-touch-targets.local.md +18 -0
- package/code-reviewer/.mcp.json +11 -0
- package/code-reviewer/README.md +346 -0
- package/code-reviewer/package-lock.json +4484 -0
- package/code-reviewer/package.json +45 -0
- package/code-reviewer/scripts/copy-assets.js +15 -0
- package/code-reviewer/scripts/setup.sh +130 -0
- package/code-reviewer/skills/brainstorming/SKILL.md +170 -0
- package/code-reviewer/skills/code-patrol/SKILL.md +176 -0
- package/code-reviewer/skills/context-resume/SKILL.md +143 -0
- package/code-reviewer/skills/executing-plans/SKILL.md +201 -0
- package/code-reviewer/skills/fix-and-learn/SKILL.md +164 -0
- package/code-reviewer/skills/health-check/SKILL.md +225 -0
- package/code-reviewer/skills/second-opinion/SKILL.md +142 -0
- package/code-reviewer/skills/systematic-debugging/SKILL.md +230 -0
- package/code-reviewer/skills/verification-before-completion/SKILL.md +170 -0
- package/code-reviewer/skills/writing-plans/SKILL.md +207 -0
- package/code-reviewer/src/__tests__/facades.test.ts +598 -0
- package/code-reviewer/src/activation/activate.ts +125 -0
- package/code-reviewer/src/activation/claude-md-content.ts +217 -0
- package/code-reviewer/src/activation/inject-claude-md.ts +113 -0
- package/code-reviewer/src/extensions/index.ts +47 -0
- package/code-reviewer/src/extensions/ops/example.ts +28 -0
- package/code-reviewer/src/identity/persona.ts +62 -0
- package/code-reviewer/src/index.ts +278 -0
- package/code-reviewer/src/intelligence/data/architecture.json +5 -0
- package/code-reviewer/src/intelligence/data/code-review.json +5 -0
- package/code-reviewer/tsconfig.json +30 -0
- package/code-reviewer/vitest.config.ts +23 -0
- package/dist/commands/create.js +6 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/extend.d.ts +2 -0
- package/dist/commands/extend.js +167 -0
- package/dist/commands/extend.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/prompts/archetypes.d.ts +21 -0
- package/dist/prompts/archetypes.js +183 -0
- package/dist/prompts/archetypes.js.map +1 -0
- package/dist/prompts/create-wizard.d.ts +1 -1
- package/dist/prompts/create-wizard.js +295 -76
- package/dist/prompts/create-wizard.js.map +1 -1
- package/dist/prompts/playbook.d.ts +63 -0
- package/dist/prompts/playbook.js +250 -0
- package/dist/prompts/playbook.js.map +1 -0
- package/package.json +1 -1
- package/src/commands/create.ts +6 -0
- package/src/commands/extend.ts +197 -0
- package/src/main.ts +2 -0
- package/src/prompts/archetypes.ts +212 -0
- package/src/prompts/create-wizard.ts +345 -69
- package/src/prompts/playbook.ts +301 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "code-reviewer-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "This agent reviews code for quality issues, anti-patterns, naming conventions, test coverage gaps, and architectural violations. It provides actionable feedback with concrete fix suggestions.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"code-reviewer-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "tsx src/index.ts",
|
|
12
|
+
"build": "tsc && node scripts/copy-assets.js",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"test:coverage": "vitest run --coverage"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"agent",
|
|
22
|
+
"code-reviewer",
|
|
23
|
+
"code-review",
|
|
24
|
+
"architecture"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
32
|
+
"@soleri/core": "^2.0.0",
|
|
33
|
+
"zod": "^3.24.2"
|
|
34
|
+
},
|
|
35
|
+
"optionalDependencies": {
|
|
36
|
+
"@anthropic-ai/sdk": "^0.39.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.13.4",
|
|
40
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
41
|
+
"tsx": "^4.19.2",
|
|
42
|
+
"typescript": "^5.7.3",
|
|
43
|
+
"vitest": "^3.0.5"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync } from 'node:fs';
|
|
2
|
+
import { join, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const root = join(__dirname, '..');
|
|
7
|
+
const dist = join(root, 'dist');
|
|
8
|
+
const dataSource = join(root, 'src', 'intelligence', 'data');
|
|
9
|
+
const dataDest = join(dist, 'intelligence', 'data');
|
|
10
|
+
|
|
11
|
+
if (existsSync(dataSource)) {
|
|
12
|
+
mkdirSync(dataDest, { recursive: true });
|
|
13
|
+
cpSync(dataSource, dataDest, { recursive: true });
|
|
14
|
+
console.log('Copied intelligence data to dist/');
|
|
15
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
AGENT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
5
|
+
AGENT_NAME="code-reviewer"
|
|
6
|
+
|
|
7
|
+
echo "=== Code Reviewer Setup ==="
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Check Node.js
|
|
11
|
+
if ! command -v node &>/dev/null; then
|
|
12
|
+
echo "Error: Node.js is not installed. Install Node.js 18+ first."
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
NODE_VERSION=$(node -v | sed 's/v//' | cut -d. -f1)
|
|
17
|
+
if [ "$NODE_VERSION" -lt 18 ]; then
|
|
18
|
+
echo "Error: Node.js 18+ required (found v$(node -v))."
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
echo "[ok] Node.js $(node -v)"
|
|
22
|
+
|
|
23
|
+
# Check if built
|
|
24
|
+
if [ ! -f "$AGENT_DIR/dist/index.js" ]; then
|
|
25
|
+
echo ""
|
|
26
|
+
echo "Building Code Reviewer..."
|
|
27
|
+
cd "$AGENT_DIR"
|
|
28
|
+
npm install
|
|
29
|
+
npm run build
|
|
30
|
+
echo "[ok] Built successfully"
|
|
31
|
+
else
|
|
32
|
+
echo "[ok] Already built"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Check Claude Code
|
|
36
|
+
if ! command -v claude &>/dev/null; then
|
|
37
|
+
echo ""
|
|
38
|
+
echo "Warning: 'claude' command not found."
|
|
39
|
+
echo "Install Claude Code first: https://docs.anthropic.com/en/docs/claude-code"
|
|
40
|
+
echo ""
|
|
41
|
+
echo "After installing, add Code Reviewer manually to ~/.claude/settings.json"
|
|
42
|
+
echo "(see README.md for the JSON config)"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
echo "[ok] Claude Code found"
|
|
46
|
+
|
|
47
|
+
# Register MCP server with Claude Code
|
|
48
|
+
echo ""
|
|
49
|
+
echo "Registering Code Reviewer with Claude Code..."
|
|
50
|
+
|
|
51
|
+
claude mcp add --scope user "$AGENT_NAME" -- node "$AGENT_DIR/dist/index.js"
|
|
52
|
+
echo "[ok] Registered Code Reviewer as MCP server"
|
|
53
|
+
|
|
54
|
+
# Configure PreCompact hook for session capture
|
|
55
|
+
SETTINGS_FILE="$HOME/.claude/settings.json"
|
|
56
|
+
echo ""
|
|
57
|
+
echo "Configuring session capture hook..."
|
|
58
|
+
|
|
59
|
+
if [ ! -d "$HOME/.claude" ]; then
|
|
60
|
+
mkdir -p "$HOME/.claude"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if [ ! -f "$SETTINGS_FILE" ]; then
|
|
64
|
+
cat > "$SETTINGS_FILE" << SETTINGS
|
|
65
|
+
{
|
|
66
|
+
"hooks": {
|
|
67
|
+
"PreCompact": [
|
|
68
|
+
{
|
|
69
|
+
"type": "prompt",
|
|
70
|
+
"prompt": "Before context is compacted, capture a session summary by calling code-reviewer_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used."
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
SETTINGS
|
|
76
|
+
echo "[ok] Created $SETTINGS_FILE with PreCompact hook"
|
|
77
|
+
else
|
|
78
|
+
if grep -q "PreCompact" "$SETTINGS_FILE" 2>/dev/null; then
|
|
79
|
+
echo "[ok] PreCompact hook already configured — skipping"
|
|
80
|
+
else
|
|
81
|
+
# Use node to safely merge hook into existing settings
|
|
82
|
+
node -e "
|
|
83
|
+
const fs = require('fs');
|
|
84
|
+
const settings = JSON.parse(fs.readFileSync('$SETTINGS_FILE', 'utf-8'));
|
|
85
|
+
if (!settings.hooks) settings.hooks = {};
|
|
86
|
+
if (!settings.hooks.PreCompact) settings.hooks.PreCompact = [];
|
|
87
|
+
settings.hooks.PreCompact.push({
|
|
88
|
+
type: 'prompt',
|
|
89
|
+
prompt: 'Before context is compacted, capture a session summary by calling code-reviewer_core op:session_capture with a brief summary of what was accomplished, the topics covered, files modified, and tools used.'
|
|
90
|
+
});
|
|
91
|
+
fs.writeFileSync('$SETTINGS_FILE', JSON.stringify(settings, null, 2) + '\n');
|
|
92
|
+
"
|
|
93
|
+
echo "[ok] Added PreCompact hook to $SETTINGS_FILE"
|
|
94
|
+
fi
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# Install skills to ~/.claude/commands/
|
|
98
|
+
SKILLS_DIR="$AGENT_DIR/skills"
|
|
99
|
+
COMMANDS_DIR="$HOME/.claude/commands"
|
|
100
|
+
|
|
101
|
+
if [ -d "$SKILLS_DIR" ]; then
|
|
102
|
+
echo ""
|
|
103
|
+
echo "Installing skills..."
|
|
104
|
+
mkdir -p "$COMMANDS_DIR"
|
|
105
|
+
skill_installed=0
|
|
106
|
+
skill_skipped=0
|
|
107
|
+
for skill_dir in "$SKILLS_DIR"/*/; do
|
|
108
|
+
[ -d "$skill_dir" ] || continue
|
|
109
|
+
skill_file="$skill_dir/SKILL.md"
|
|
110
|
+
[ -f "$skill_file" ] || continue
|
|
111
|
+
skill_name="$(basename "$skill_dir")"
|
|
112
|
+
dest="$COMMANDS_DIR/$skill_name.md"
|
|
113
|
+
if [ -f "$dest" ]; then
|
|
114
|
+
skill_skipped=$((skill_skipped + 1))
|
|
115
|
+
else
|
|
116
|
+
cp "$skill_file" "$dest"
|
|
117
|
+
skill_installed=$((skill_installed + 1))
|
|
118
|
+
fi
|
|
119
|
+
done
|
|
120
|
+
echo "[ok] Skills: $skill_installed installed, $skill_skipped already present"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
echo ""
|
|
124
|
+
echo "=== Setup Complete ==="
|
|
125
|
+
echo ""
|
|
126
|
+
echo "Next:"
|
|
127
|
+
echo " 1. Start a new Claude Code session (or restart if one is open)"
|
|
128
|
+
echo " 2. Say: \"Hello, Code Reviewer!\""
|
|
129
|
+
echo ""
|
|
130
|
+
echo "Code Reviewer will activate and guide you from there."
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- Adapted from superpowers (MIT License) -->
|
|
7
|
+
|
|
8
|
+
# Brainstorming Ideas Into Designs
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
13
|
+
|
|
14
|
+
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
|
|
15
|
+
|
|
16
|
+
<HARD-GATE>
|
|
17
|
+
Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
|
|
18
|
+
</HARD-GATE>
|
|
19
|
+
|
|
20
|
+
## Anti-Pattern: "This Is Too Simple To Need A Design"
|
|
21
|
+
|
|
22
|
+
Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
|
|
23
|
+
|
|
24
|
+
## Checklist
|
|
25
|
+
|
|
26
|
+
You MUST create a task for each of these items and complete them in order:
|
|
27
|
+
|
|
28
|
+
1. **Classify intent** — understand what type of work this is
|
|
29
|
+
2. **Search vault for prior art** — check if something similar was built, decided, or rejected before
|
|
30
|
+
3. **Search web for existing solutions** — don't build what already exists
|
|
31
|
+
4. **Explore project context** — check files, docs, recent commits
|
|
32
|
+
5. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
|
|
33
|
+
6. **Propose 2-3 approaches** — with trade-offs and your recommendation
|
|
34
|
+
7. **Present design** — in sections scaled to their complexity, get user approval after each section
|
|
35
|
+
8. **Capture design decision** — persist the decision to the vault
|
|
36
|
+
9. **Write design doc** — save to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit
|
|
37
|
+
10. **Transition to implementation** — invoke writing-plans skill to create implementation plan
|
|
38
|
+
|
|
39
|
+
## Step 0: Classify Intent
|
|
40
|
+
|
|
41
|
+
Before anything else, understand the type of work:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
code-reviewer_core op:route_intent
|
|
45
|
+
params: { prompt: "<the user's request>" }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This returns the intent type (BUILD, FIX, VALIDATE, DESIGN, IMPROVE, DELIVER) and routing guidance. Use this to focus the brainstorming — a FIX intent needs different questions than a BUILD intent.
|
|
49
|
+
|
|
50
|
+
## Step 1: Search Before Designing — Vault, Then Web
|
|
51
|
+
|
|
52
|
+
**BEFORE asking any questions or exploring code**, search for existing knowledge. Follow this order:
|
|
53
|
+
|
|
54
|
+
### Vault First
|
|
55
|
+
```
|
|
56
|
+
code-reviewer_core op:search_intelligent
|
|
57
|
+
params: { query: "<the feature or idea the user described>" }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Look for:
|
|
61
|
+
- **Previous designs** — was this discussed or attempted before?
|
|
62
|
+
- **Architectural decisions** — are there constraints from past decisions?
|
|
63
|
+
- **Patterns** — established approaches in this codebase
|
|
64
|
+
- **Anti-patterns** — approaches that were tried and failed
|
|
65
|
+
|
|
66
|
+
Browse the knowledge landscape for related context:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
code-reviewer_core op:vault_tags
|
|
70
|
+
code-reviewer_core op:vault_domains
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Check what the brain says about proven patterns in this domain:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
code-reviewer_core op:brain_strengths
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Check if other linked projects have solved this:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
code-reviewer_core op:memory_cross_project_search
|
|
83
|
+
params: { query: "<the feature>", crossProject: true }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Web Search Second
|
|
87
|
+
If the vault doesn't have prior art, search the web for:
|
|
88
|
+
- **Existing libraries/tools** that solve this problem (don't build what exists)
|
|
89
|
+
- **Reference implementations** in similar projects
|
|
90
|
+
- **Best practices** and established patterns for this type of feature
|
|
91
|
+
- **Known pitfalls** that others have documented
|
|
92
|
+
|
|
93
|
+
### Present Findings
|
|
94
|
+
Present vault + web findings to the user: "Before we design this, here's what I found..." This informs the design conversation and prevents reinventing solutions.
|
|
95
|
+
|
|
96
|
+
## The Process
|
|
97
|
+
|
|
98
|
+
**Understanding the idea:**
|
|
99
|
+
- Check out the current project state first (files, docs, recent commits)
|
|
100
|
+
- Ask questions one at a time to refine the idea
|
|
101
|
+
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
102
|
+
- Only one question per message
|
|
103
|
+
- Focus on understanding: purpose, constraints, success criteria
|
|
104
|
+
|
|
105
|
+
**Exploring approaches:**
|
|
106
|
+
- Propose 2-3 different approaches with trade-offs
|
|
107
|
+
- Present options conversationally with your recommendation and reasoning
|
|
108
|
+
- Lead with your recommended option and explain why
|
|
109
|
+
- **Reference vault patterns** — if the vault has a proven approach, lead with it
|
|
110
|
+
- **Reference web findings** — if an existing library solves this, recommend it over custom code
|
|
111
|
+
|
|
112
|
+
**Presenting the design:**
|
|
113
|
+
- Once you understand what you're building, present the design
|
|
114
|
+
- Scale each section to its complexity
|
|
115
|
+
- Ask after each section whether it looks right so far
|
|
116
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
117
|
+
|
|
118
|
+
## After the Design
|
|
119
|
+
|
|
120
|
+
**Capture the design decision to the vault:**
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
code-reviewer_core op:capture_knowledge
|
|
124
|
+
params: {
|
|
125
|
+
title: "<feature name> — design decision",
|
|
126
|
+
description: "<chosen approach, rationale, rejected alternatives>",
|
|
127
|
+
type: "decision",
|
|
128
|
+
category: "<relevant domain>",
|
|
129
|
+
tags: ["<relevant>", "<tags>", "design-decision"]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
This ensures future brainstorming sessions can reference what was decided and why.
|
|
134
|
+
|
|
135
|
+
**Documentation:**
|
|
136
|
+
- Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
137
|
+
- Commit the design document to git
|
|
138
|
+
|
|
139
|
+
**Implementation:**
|
|
140
|
+
- Invoke the writing-plans skill to create a detailed implementation plan
|
|
141
|
+
- Do NOT invoke any other skill. writing-plans is the next step.
|
|
142
|
+
|
|
143
|
+
## Process Flow
|
|
144
|
+
|
|
145
|
+
**The terminal state is invoking writing-plans.** Do NOT invoke any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans.
|
|
146
|
+
|
|
147
|
+
## Key Principles
|
|
148
|
+
|
|
149
|
+
- **Classify first** — understand intent before diving in
|
|
150
|
+
- **Vault first** — don't reinvent what's been decided or solved before
|
|
151
|
+
- **Web second** — don't build what already exists as a library
|
|
152
|
+
- **One question at a time** — don't overwhelm with multiple questions
|
|
153
|
+
- **Multiple choice preferred** — easier to answer than open-ended when possible
|
|
154
|
+
- **YAGNI ruthlessly** — remove unnecessary features from all designs
|
|
155
|
+
- **Explore alternatives** — always propose 2-3 approaches before settling
|
|
156
|
+
- **Incremental validation** — present design, get approval before moving on
|
|
157
|
+
- **Capture decisions** — every design decision gets persisted to the vault
|
|
158
|
+
- **Cross-project learning** — check if other projects solved this already
|
|
159
|
+
- **Be flexible** — go back and clarify when something doesn't make sense
|
|
160
|
+
|
|
161
|
+
## Agent Tools Reference
|
|
162
|
+
|
|
163
|
+
| Op | When to Use |
|
|
164
|
+
|----|-------------|
|
|
165
|
+
| `route_intent` | Classify the type of work (BUILD, FIX, etc.) |
|
|
166
|
+
| `search_intelligent` | Search vault for prior art |
|
|
167
|
+
| `vault_tags` / `vault_domains` | Browse knowledge landscape |
|
|
168
|
+
| `brain_strengths` | Check proven patterns |
|
|
169
|
+
| `memory_cross_project_search` | Check if other projects solved this |
|
|
170
|
+
| `capture_knowledge` | Persist design decision to vault |
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-patrol
|
|
3
|
+
description: Use when the user asks "review this code", "check this against patterns", "code patrol", "does this follow our rules", "validate against vault", "check for anti-patterns", or wants code reviewed not against generic lint rules but against the project's own captured patterns, anti-patterns, and conventions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Patrol — Review Code Against Your Own Knowledge
|
|
7
|
+
|
|
8
|
+
Review code against the vault's patterns, anti-patterns, and project conventions — not generic lint rules, but YOUR team's captured knowledge applied to new code. Catches violations that no linter knows about.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Before committing or creating a PR
|
|
13
|
+
- "Does this follow our patterns?"
|
|
14
|
+
- "Check this code against our rules"
|
|
15
|
+
- Code review with institutional knowledge
|
|
16
|
+
- After writing implementation code
|
|
17
|
+
|
|
18
|
+
## The Magic: Project-Specific Code Intelligence
|
|
19
|
+
|
|
20
|
+
### Step 1: Understand the Code's Domain
|
|
21
|
+
|
|
22
|
+
Classify what domain this code belongs to:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
code-reviewer_core op:route_intent
|
|
26
|
+
params: { prompt: "Code review: <brief description of the code>" }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Determine which vault domains are relevant:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
code-reviewer_core op:vault_domains
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 2: Load Relevant Patterns
|
|
36
|
+
|
|
37
|
+
Search for patterns in the code's domain:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
code-reviewer_core op:search_intelligent
|
|
41
|
+
params: { query: "<what this code does>" }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Search specifically for anti-patterns to check against:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
code-reviewer_core op:search
|
|
48
|
+
params: { type: "anti-pattern" }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Search for critical rules that must not be violated:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
code-reviewer_core op:search
|
|
55
|
+
params: { severity: "critical" }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Load project-specific rules:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
code-reviewer_core op:project_list_rules
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
code-reviewer_core op:get_behavior_rules
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Get proven approaches from the brain:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
code-reviewer_core op:brain_strengths
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Step 3: Review the Code
|
|
75
|
+
|
|
76
|
+
With vault patterns loaded, review the code checking for:
|
|
77
|
+
|
|
78
|
+
| Check | Source | Severity |
|
|
79
|
+
|-------|--------|----------|
|
|
80
|
+
| Violates a critical rule | `search (severity: critical)` | Must fix |
|
|
81
|
+
| Matches a known anti-pattern | `search (type: anti-pattern)` | Must fix |
|
|
82
|
+
| Doesn't follow a proven pattern | `brain_strengths` | Should fix |
|
|
83
|
+
| Breaks project conventions | `project_list_rules` | Should fix |
|
|
84
|
+
| Misses an opportunity to use a pattern | `search_intelligent` | Could improve |
|
|
85
|
+
|
|
86
|
+
### Step 4: Present the Review
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
## Code Patrol Report
|
|
90
|
+
|
|
91
|
+
### Must Fix (Critical)
|
|
92
|
+
- **[Rule name]**: [What's wrong and why]
|
|
93
|
+
Vault ref: [entry title] (severity: critical)
|
|
94
|
+
Fix: [How to fix it]
|
|
95
|
+
|
|
96
|
+
### Should Fix (Warning)
|
|
97
|
+
- **[Anti-pattern name]**: [What's wrong]
|
|
98
|
+
Vault ref: [entry title] (type: anti-pattern)
|
|
99
|
+
Better approach: [The pattern to follow]
|
|
100
|
+
|
|
101
|
+
### Could Improve (Suggestion)
|
|
102
|
+
- **[Pattern opportunity]**: [The code works but could benefit from...]
|
|
103
|
+
Vault ref: [entry title] (type: pattern)
|
|
104
|
+
|
|
105
|
+
### Looks Good
|
|
106
|
+
- [What the code does well — patterns it follows correctly]
|
|
107
|
+
|
|
108
|
+
### Summary
|
|
109
|
+
X critical issues, Y warnings, Z suggestions
|
|
110
|
+
Patterns followed: [list]
|
|
111
|
+
Patterns missed: [list]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Step 5: Learn From the Review
|
|
115
|
+
|
|
116
|
+
If the review reveals a new pattern or anti-pattern not in the vault, capture it:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
code-reviewer_core op:capture_quick
|
|
120
|
+
params: {
|
|
121
|
+
title: "<new pattern or anti-pattern discovered>",
|
|
122
|
+
description: "<what it is, when it applies>"
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If the review reveals a knowledge gap, note it:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
code-reviewer_core op:capture_knowledge
|
|
130
|
+
params: {
|
|
131
|
+
title: "<missing convention>",
|
|
132
|
+
description: "<this should be documented as a project rule>",
|
|
133
|
+
type: "principle",
|
|
134
|
+
category: "<domain>",
|
|
135
|
+
tags: ["convention", "code-review"]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Step 6: Verify After Fixes
|
|
140
|
+
|
|
141
|
+
After the user applies fixes, re-run the patrol to confirm clean:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
code-reviewer_core op:search_intelligent
|
|
145
|
+
params: { query: "<re-check the specific violations>" }
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Check system health:
|
|
149
|
+
```
|
|
150
|
+
code-reviewer_core op:admin_health
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## The Magic
|
|
154
|
+
|
|
155
|
+
This feels like magic because:
|
|
156
|
+
1. It's not ESLint — it catches things like "we decided not to use inheritance here" or "this API pattern caused production issues last month"
|
|
157
|
+
2. The rules come from YOUR team's experience, not a generic config file
|
|
158
|
+
3. It gets smarter over time — every captured pattern becomes a new check
|
|
159
|
+
4. It catches institutional knowledge violations that no static analyzer can
|
|
160
|
+
|
|
161
|
+
A linter checks syntax. Code patrol checks wisdom.
|
|
162
|
+
|
|
163
|
+
## Agent Tools Reference
|
|
164
|
+
|
|
165
|
+
| Op | When to Use |
|
|
166
|
+
|----|-------------|
|
|
167
|
+
| `route_intent` | Classify the code's domain |
|
|
168
|
+
| `vault_domains` | See which domains are relevant |
|
|
169
|
+
| `search_intelligent` | Find relevant patterns for this code |
|
|
170
|
+
| `search` | Find anti-patterns and critical rules |
|
|
171
|
+
| `project_list_rules` | Project-specific conventions |
|
|
172
|
+
| `get_behavior_rules` | Behavioral rules |
|
|
173
|
+
| `brain_strengths` | Proven patterns to check against |
|
|
174
|
+
| `capture_quick` | Capture new patterns discovered during review |
|
|
175
|
+
| `capture_knowledge` | Capture new conventions |
|
|
176
|
+
| `admin_health` | Post-review health check |
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-resume
|
|
3
|
+
description: Use when starting a new session, returning to work, or when the user asks "what was I working on", "where did I leave off", "catch me up", "morning standup", "resume", "what's the status". Reconstructs full working context from memory, plans, and sessions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Resume — Pick Up Where You Left Off
|
|
7
|
+
|
|
8
|
+
Reconstruct your full working context in seconds. Chains memory, plans, sessions, and brain to rebuild exactly where you left off — even across session boundaries and context compactions.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Starting a new Claude Code session
|
|
13
|
+
- Returning after a break
|
|
14
|
+
- "What was I working on?"
|
|
15
|
+
- "Morning standup"
|
|
16
|
+
- After context compaction (session_capture fires automatically, this reads it back)
|
|
17
|
+
|
|
18
|
+
## The Magic: Full Context Reconstruction
|
|
19
|
+
|
|
20
|
+
### Step 1: Load Active Plans
|
|
21
|
+
|
|
22
|
+
Check for plans in progress — these are your active work streams:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
code-reviewer_core op:plan_stats
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For each active plan, load its details and task status:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
code-reviewer_core op:get_plan
|
|
32
|
+
code-reviewer_core op:plan_list_tasks
|
|
33
|
+
params: { planId: "<id>" }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Present:
|
|
37
|
+
- Plan objective and current status
|
|
38
|
+
- Which tasks are completed, in progress, or pending
|
|
39
|
+
- What's next to do
|
|
40
|
+
|
|
41
|
+
### Step 2: Search Recent Memory
|
|
42
|
+
|
|
43
|
+
Load the latest session summaries — these capture what happened before:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
code-reviewer_core op:memory_search
|
|
47
|
+
params: { query: "session summary" }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
code-reviewer_core op:memory_list
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Also check recent vault captures — what knowledge was added recently?
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
code-reviewer_core op:vault_recent
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 3: Check Active Loops
|
|
61
|
+
|
|
62
|
+
See if there's a validation loop in progress:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
code-reviewer_core op:loop_is_active
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If active:
|
|
69
|
+
```
|
|
70
|
+
code-reviewer_core op:loop_status
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This tells you if an iterative workflow (TDD, debugging, migration) was mid-flight.
|
|
74
|
+
|
|
75
|
+
### Step 4: Brain Snapshot
|
|
76
|
+
|
|
77
|
+
Get the latest brain insights relevant to current work:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
code-reviewer_core op:brain_strengths
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Step 5: System Health
|
|
84
|
+
|
|
85
|
+
Quick health check to make sure everything is working:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
code-reviewer_core op:admin_health
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Presenting the Resume
|
|
92
|
+
|
|
93
|
+
Format as a concise standup:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
## Where You Left Off
|
|
97
|
+
|
|
98
|
+
**Active Plans:**
|
|
99
|
+
- [Plan name] — X/Y tasks complete, next: [task description]
|
|
100
|
+
|
|
101
|
+
**Last Session:**
|
|
102
|
+
- [Summary from memory — what was done, key decisions]
|
|
103
|
+
|
|
104
|
+
**Recent Captures:**
|
|
105
|
+
- [New patterns/anti-patterns added to vault]
|
|
106
|
+
|
|
107
|
+
**Active Loops:**
|
|
108
|
+
- [Any in-progress validation loops]
|
|
109
|
+
|
|
110
|
+
**Brain Says:**
|
|
111
|
+
- [Top relevant patterns for current work]
|
|
112
|
+
|
|
113
|
+
**Health:** [OK / Issues found]
|
|
114
|
+
|
|
115
|
+
## Recommended Next Step
|
|
116
|
+
[Based on active plans and last session context]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## The Magic
|
|
120
|
+
|
|
121
|
+
This feels like magic because the user just says "catch me up" and the agent:
|
|
122
|
+
1. Knows what plans are active and where they stand
|
|
123
|
+
2. Remembers what happened last session (even across context compactions)
|
|
124
|
+
3. Shows what knowledge was recently captured
|
|
125
|
+
4. Detects in-flight loops
|
|
126
|
+
5. Recommends what to work on next
|
|
127
|
+
|
|
128
|
+
No other tool does this — the agent has genuine persistent memory.
|
|
129
|
+
|
|
130
|
+
## Agent Tools Reference
|
|
131
|
+
|
|
132
|
+
| Op | When to Use |
|
|
133
|
+
|----|-------------|
|
|
134
|
+
| `plan_stats` | Find active plans |
|
|
135
|
+
| `get_plan` | Load plan details |
|
|
136
|
+
| `plan_list_tasks` | See task status within plan |
|
|
137
|
+
| `memory_search` | Find session summaries |
|
|
138
|
+
| `memory_list` | Browse recent memories |
|
|
139
|
+
| `vault_recent` | Recently captured knowledge |
|
|
140
|
+
| `loop_is_active` | Check for in-flight loops |
|
|
141
|
+
| `loop_status` | Get loop details |
|
|
142
|
+
| `brain_strengths` | Relevant proven patterns |
|
|
143
|
+
| `admin_health` | System health check |
|