@esoteric-logic/praxis-harness 2.1.1 → 2.3.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/base/CLAUDE.md +12 -2
- package/base/rules/context-management.md +12 -0
- package/base/rules/memory-boundary.md +56 -0
- package/base/skills/context-probe/SKILL.md +57 -0
- package/base/skills/repair/SKILL.md +130 -0
- package/base/skills/review/SKILL.md +1 -0
- package/base/skills/simplify/SKILL.md +1 -0
- package/base/skills/subagent/SKILL.md +109 -0
- package/base/skills/sync-memory/SKILL.md +94 -0
- package/base/skills/verify/SKILL.md +5 -6
- package/base/skills/verify-app/SKILL.md +1 -0
- package/kits/api/KIT.md +48 -0
- package/kits/api/commands/api-contract.md +18 -0
- package/kits/api/commands/api-review.md +19 -0
- package/kits/api/commands/api-spec.md +19 -0
- package/kits/api/install.sh +38 -0
- package/kits/api/rules/api-design.md +63 -0
- package/kits/api/teardown.sh +13 -0
- package/kits/data/KIT.md +48 -0
- package/kits/data/commands/migration-plan.md +23 -0
- package/kits/data/commands/query-review.md +21 -0
- package/kits/data/commands/schema-design.md +22 -0
- package/kits/data/install.sh +40 -0
- package/kits/data/rules/data.md +43 -0
- package/kits/data/teardown.sh +14 -0
- package/kits/security/KIT.md +49 -0
- package/kits/security/commands/iam-review.md +19 -0
- package/kits/security/commands/security-audit.md +23 -0
- package/kits/security/commands/threat-model.md +20 -0
- package/kits/security/install.sh +39 -0
- package/kits/security/rules/security.md +57 -0
- package/kits/security/teardown.sh +14 -0
- package/package.json +2 -2
- package/scripts/test-harness.sh +172 -0
package/base/CLAUDE.md
CHANGED
|
@@ -81,7 +81,13 @@ Registered via `claude mcp add`. Persist globally across sessions.
|
|
|
81
81
|
| context7 | Live library/API docs | None |
|
|
82
82
|
| github | Repo operations, PRs, issues | `GITHUB_PERSONAL_ACCESS_TOKEN` |
|
|
83
83
|
|
|
84
|
-
Optional
|
|
84
|
+
**Optional servers** — enhance but don't require Praxis:
|
|
85
|
+
|
|
86
|
+
| Server | Purpose | Install | Degrades without |
|
|
87
|
+
|--------|---------|---------|-----------------|
|
|
88
|
+
| perplexity | AI web search | `bash scripts/onboard-mcp.sh perplexity` | No web research in `/discover` |
|
|
89
|
+
| filesystem | Direct vault file access | `claude mcp add filesystem` | Uses shell for vault reads |
|
|
90
|
+
| sequential-thinking | Multi-step reasoning | `claude mcp add sequential-thinking` | Standard reasoning only |
|
|
85
91
|
|
|
86
92
|
Check: `claude mcp list` | Manage: `bash scripts/onboard-mcp.sh [server|all]`
|
|
87
93
|
Missing servers are non-blocking — features degrade gracefully.
|
|
@@ -116,12 +122,15 @@ Kits activate via `/kit:<n>` slash command. Kits are idempotent — double-activ
|
|
|
116
122
|
|-----|----------|--------|
|
|
117
123
|
| web-designer | `/kit:web-designer` | Design system → components → accessibility → production lint |
|
|
118
124
|
| infrastructure | `/kit:infrastructure` | Terraform → Azure → GitHub Actions → compliance |
|
|
125
|
+
| api | `/kit:api` | RESTful conventions → OpenAPI specs → contract testing |
|
|
126
|
+
| security | `/kit:security` | Threat modeling → IAM review → OWASP audit |
|
|
127
|
+
| data | `/kit:data` | Schema design → migration planning → query optimization |
|
|
119
128
|
|
|
120
129
|
Kit manifests live in `~/.claude/kits/<name>/KIT.md`.
|
|
121
130
|
|
|
122
131
|
## Rules Registry — Load on Demand Only
|
|
123
132
|
|
|
124
|
-
### Universal — always active (
|
|
133
|
+
### Universal — always active (7 rules)
|
|
125
134
|
| File | Purpose |
|
|
126
135
|
|------|---------|
|
|
127
136
|
| `~/.claude/rules/profile.md` | Who the user is, identities, working style |
|
|
@@ -130,6 +139,7 @@ Kit manifests live in `~/.claude/kits/<name>/KIT.md`.
|
|
|
130
139
|
| `~/.claude/rules/git-workflow.md` | Commits, branches, identity verification, pre-commit checks |
|
|
131
140
|
| `~/.claude/rules/vault.md` | Second brain integration — vault backend, file purposes |
|
|
132
141
|
| `~/.claude/rules/context-management.md` | Context anti-rot, phase scoping, context reset protocol |
|
|
142
|
+
| `~/.claude/rules/memory-boundary.md` | Auto-memory boundary, MEMORY.md cap, dream integration |
|
|
133
143
|
|
|
134
144
|
### Scoped — load only when paths match
|
|
135
145
|
| File | Loads when |
|
|
@@ -82,6 +82,18 @@ ls -la {vault_path}/plans/
|
|
|
82
82
|
stat -f "%Sm" {vault_path}/status.md
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
## Memory Hygiene — Conventions (WARN on violation)
|
|
86
|
+
|
|
87
|
+
### Before starting a new kit or major task
|
|
88
|
+
1. Run `/dream` (if available) to consolidate stale auto-memory
|
|
89
|
+
2. Run `/sync-memory` to bridge durable insights to Obsidian vault
|
|
90
|
+
3. Proceed with clean, consolidated context
|
|
91
|
+
|
|
92
|
+
### MEMORY.md cap
|
|
93
|
+
- Keep under 80 lines. Auto-dream and `/sync-memory` enforce this.
|
|
94
|
+
- If MEMORY.md exceeds 80 lines: run `/sync-memory` before continuing.
|
|
95
|
+
- See `~/.claude/rules/memory-boundary.md` for full boundary rules.
|
|
96
|
+
|
|
85
97
|
---
|
|
86
98
|
|
|
87
99
|
## Removal Condition
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Memory Boundary — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Defines what goes where across CLAUDE.md, MEMORY.md, and Obsidian vault
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
### CLAUDE.md rules always win
|
|
8
|
+
- If a MEMORY.md entry conflicts with a CLAUDE.md rule or base/ rule, the rule wins.
|
|
9
|
+
- Never override architectural decisions, coding standards, or workflow sequences via auto-memory.
|
|
10
|
+
- Auto-memory supplements rules — it does not replace them.
|
|
11
|
+
|
|
12
|
+
### No architectural decisions in MEMORY.md
|
|
13
|
+
- Architecture decisions, design patterns, and system constraints belong in CLAUDE.md or Obsidian vault specs/.
|
|
14
|
+
- If Claude discovers a decision-worthy pattern during a session, surface it to the user for CLAUDE.md or vault — do not write it to MEMORY.md.
|
|
15
|
+
|
|
16
|
+
### MEMORY.md cap
|
|
17
|
+
- Keep MEMORY.md under 80 lines. Use topic files for overflow.
|
|
18
|
+
- Prefer linking to Obsidian vault notes over expanding MEMORY.md.
|
|
19
|
+
- If MEMORY.md exceeds 80 lines: run `/sync-memory` before continuing.
|
|
20
|
+
- The 200-line hard limit means lines beyond 200 are silently dropped — the 80-line cap leaves headroom for topic file index entries.
|
|
21
|
+
|
|
22
|
+
## Conventions — WARN on violation
|
|
23
|
+
|
|
24
|
+
### What belongs where
|
|
25
|
+
|
|
26
|
+
| Content | Destination | Managed by |
|
|
27
|
+
|---------|-------------|------------|
|
|
28
|
+
| Coding standards, workflows, architecture | `CLAUDE.md` / `base/rules/` | User (Praxis) |
|
|
29
|
+
| Build quirks, CLI flags, error patterns | `MEMORY.md` | Claude (auto-memory + auto-dream) |
|
|
30
|
+
| Architecture decisions, project status, session summaries | Obsidian vault | User (via Praxis skills) |
|
|
31
|
+
| Kit configs, path-scoped rules | `kits/` and `base/rules/` | User (Praxis) |
|
|
32
|
+
| Stale or conflicting memory entries | Deleted | Auto-dream consolidation or `/sync-memory` |
|
|
33
|
+
|
|
34
|
+
### Auto-memory territory (appropriate for MEMORY.md)
|
|
35
|
+
- Build commands and environment quirks Claude discovers
|
|
36
|
+
- Debugging insights specific to this working tree
|
|
37
|
+
- API gotchas, error patterns, CLI flags that worked
|
|
38
|
+
- User preferences Claude infers from corrections
|
|
39
|
+
- Tool configuration that varies per machine
|
|
40
|
+
|
|
41
|
+
### Not auto-memory territory (redirect elsewhere)
|
|
42
|
+
- Decisions that affect system design → CLAUDE.md or vault specs/
|
|
43
|
+
- Cross-project learnings → vault notes/learnings.md
|
|
44
|
+
- Session summaries → vault notes/ (auto-documented by Stop hook)
|
|
45
|
+
- Task tracking → vault tasks.md
|
|
46
|
+
- Plans and milestones → vault plans/
|
|
47
|
+
|
|
48
|
+
### Dream and consolidation
|
|
49
|
+
- Run `/dream` (if available) between sessions to consolidate stale memory
|
|
50
|
+
- Run `/sync-memory` to bridge durable insights from MEMORY.md to Obsidian vault
|
|
51
|
+
- Auto-dream fires automatically after 24h + 5 sessions — the memory-boundary rules guide what it keeps vs prunes
|
|
52
|
+
- After `/dream` or auto-dream runs: verify MEMORY.md is under 80 lines
|
|
53
|
+
|
|
54
|
+
## Removal Condition
|
|
55
|
+
Remove when Claude Code provides native memory scoping that respects rule hierarchies
|
|
56
|
+
and vault integration without manual boundary enforcement.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-probe
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: "Assess current context health and recommend action. Reads session data and conversation signals to estimate context bracket (FRESH/MODERATE/DEPLETED/CRITICAL)."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# context-probe Skill
|
|
8
|
+
|
|
9
|
+
You are assessing the current session's context health.
|
|
10
|
+
|
|
11
|
+
## Vault Path Resolution
|
|
12
|
+
Read vault_path from `~/.claude/praxis.config.json`.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
**Step 1 — Gather signals**
|
|
17
|
+
|
|
18
|
+
Assess these indicators (do NOT read external files just for this — use what you already know):
|
|
19
|
+
|
|
20
|
+
| Signal | How to assess |
|
|
21
|
+
|--------|--------------|
|
|
22
|
+
| Conversation length | Estimate from your sense of how much has been discussed |
|
|
23
|
+
| Tool calls made | Rough count of reads, writes, bash calls this session |
|
|
24
|
+
| Files touched | How many files have been read or edited |
|
|
25
|
+
| Corrections received | How many times the user corrected your output |
|
|
26
|
+
| Compaction occurred | Did you receive a compaction bootstrap? |
|
|
27
|
+
| Active task complexity | Simple (1-2 files) vs complex (5+ files, multi-milestone) |
|
|
28
|
+
|
|
29
|
+
**Step 2 — Estimate bracket**
|
|
30
|
+
|
|
31
|
+
| Bracket | Signals | Action |
|
|
32
|
+
|---------|---------|--------|
|
|
33
|
+
| **FRESH** | <10 tool calls, <5 files, no corrections, no compaction | Full speed. Batch aggressively. Load full context. |
|
|
34
|
+
| **MODERATE** | 10-30 tool calls, 5-15 files, 0-1 corrections | Re-read key requirements before decisions. Prefer concise output. |
|
|
35
|
+
| **DEPLETED** | 30+ tool calls, 15+ files, 2+ corrections, OR scope drift detected | Checkpoint to vault NOW. Write milestone summaries. Suggest `/session-retro` + `/clear`. |
|
|
36
|
+
| **CRITICAL** | Post-compaction, OR repeated corrections, OR instruction drift | STOP new work. Complete current milestone only. Write all state to vault. Start new session. |
|
|
37
|
+
|
|
38
|
+
**Step 3 — Report**
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
CONTEXT PROBE
|
|
42
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
43
|
+
Bracket: {FRESH | MODERATE | DEPLETED | CRITICAL}
|
|
44
|
+
Signals: {key indicators}
|
|
45
|
+
Action: {recommendation}
|
|
46
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Step 4 — Act on DEPLETED/CRITICAL**
|
|
50
|
+
|
|
51
|
+
If DEPLETED or CRITICAL:
|
|
52
|
+
1. Update `{vault_path}/status.md` with current state
|
|
53
|
+
2. Write any in-progress decisions to the active plan file
|
|
54
|
+
3. Suggest: "Context is [bracket name]. Recommend `/session-retro` then `/clear` for a fresh start."
|
|
55
|
+
|
|
56
|
+
## Removal Condition
|
|
57
|
+
Remove when Claude Code exposes token count or context utilization metrics natively.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: repair
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: "Structured repair phase for failed milestones. 3-attempt fix-and-verify loop with root cause analysis. Triggered by /verify failure or manually."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# repair Skill
|
|
8
|
+
|
|
9
|
+
You are running a structured repair cycle for a failed milestone.
|
|
10
|
+
|
|
11
|
+
## Vault Path Resolution
|
|
12
|
+
Read vault_path from `~/.claude/praxis.config.json`.
|
|
13
|
+
|
|
14
|
+
## Acceptance
|
|
15
|
+
- [ ] Failure captured with exact error, file, line
|
|
16
|
+
- [ ] Root cause classified (flawed implementation vs flawed spec)
|
|
17
|
+
- [ ] Fix applied with minimal diff
|
|
18
|
+
- [ ] Validation passes after fix
|
|
19
|
+
- [ ] Repair trace written to vault
|
|
20
|
+
|
|
21
|
+
## Boundaries
|
|
22
|
+
- No refactoring — fix the failure, nothing else
|
|
23
|
+
- No scope expansion — do not add features or change behavior beyond the fix
|
|
24
|
+
- No new files unless the fix requires them
|
|
25
|
+
- Maximum 3 attempts before STOP
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
**Step 1 — Capture failure**
|
|
30
|
+
- Read the failure output from `/verify` (or ask user for the error)
|
|
31
|
+
- Extract: exact error message, file(s), line number(s), test name (if applicable)
|
|
32
|
+
- State the failure in one sentence:
|
|
33
|
+
`Failure: {what failed} in {file}:{line} because {symptom}.`
|
|
34
|
+
|
|
35
|
+
**Step 2 — Classify root cause**
|
|
36
|
+
Determine whether this is:
|
|
37
|
+
- **Flawed implementation** → the code doesn't match the spec. Fix forward.
|
|
38
|
+
- **Flawed spec** → the spec itself is wrong or incomplete. STOP.
|
|
39
|
+
Report to user: "Spec issue detected: [describe the issue]. Run `/discuss` to re-spec before continuing."
|
|
40
|
+
Do not attempt to fix spec issues — that's a different phase.
|
|
41
|
+
|
|
42
|
+
**Step 3 — Fix attempt (attempt {n}/3)**
|
|
43
|
+
- State what you're changing and why in one sentence
|
|
44
|
+
- Apply the minimal fix — smallest diff that addresses the root cause
|
|
45
|
+
- Do not refactor surrounding code
|
|
46
|
+
- Do not fix unrelated issues discovered during repair
|
|
47
|
+
|
|
48
|
+
**Step 4 — Re-validate**
|
|
49
|
+
Run the full validation sequence from `/verify` Step 1:
|
|
50
|
+
1. Test suite
|
|
51
|
+
2. Linter
|
|
52
|
+
3. Typecheck (if applicable)
|
|
53
|
+
4. Build (if applicable)
|
|
54
|
+
|
|
55
|
+
**Step 5 — Evaluate result**
|
|
56
|
+
- **PASS** → Milestone repaired. Commit the fix. Return to workflow.
|
|
57
|
+
Output: `Repaired: {what was fixed} in {file}. Next: continue with /execute or /verify.`
|
|
58
|
+
- **FAIL (same error)** → Root cause was misidentified. Re-analyze in Step 2.
|
|
59
|
+
- **FAIL (different error)** → Fix introduced a regression. Revert the fix, re-analyze.
|
|
60
|
+
- Track attempt count. If attempt 3 fails → Step 6.
|
|
61
|
+
|
|
62
|
+
**Step 6 — STOP after 3 failures**
|
|
63
|
+
Do not attempt a 4th fix. Report:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
REPAIR FAILED — 3 attempts exhausted
|
|
67
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
68
|
+
|
|
69
|
+
What: {original failure + all 3 attempt descriptions}
|
|
70
|
+
So What: {root cause analysis — why 3 fixes didn't work}
|
|
71
|
+
Now What: {recommended next step: re-spec, different approach, escalate}
|
|
72
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Step 7 — Write repair trace to vault**
|
|
76
|
+
Whether the repair succeeded or failed, write to `{vault_path}/notes/{YYYY-MM-DD}_repair-trace.md`:
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
---
|
|
80
|
+
tags: [repair, {project-slug}]
|
|
81
|
+
date: {YYYY-MM-DD}
|
|
82
|
+
source: agent
|
|
83
|
+
---
|
|
84
|
+
# Repair Trace — {short title}
|
|
85
|
+
|
|
86
|
+
## Original Failure
|
|
87
|
+
{error message, file, line}
|
|
88
|
+
|
|
89
|
+
## Root Cause
|
|
90
|
+
{classification: flawed implementation | flawed spec}
|
|
91
|
+
{root cause statement}
|
|
92
|
+
|
|
93
|
+
## Attempts
|
|
94
|
+
### Attempt 1
|
|
95
|
+
- Fix: {what was changed}
|
|
96
|
+
- Result: {PASS | FAIL — error}
|
|
97
|
+
|
|
98
|
+
### Attempt 2 (if applicable)
|
|
99
|
+
- Fix: {what was changed}
|
|
100
|
+
- Result: {PASS | FAIL — error}
|
|
101
|
+
|
|
102
|
+
### Attempt 3 (if applicable)
|
|
103
|
+
- Fix: {what was changed}
|
|
104
|
+
- Result: {PASS | FAIL — error}
|
|
105
|
+
|
|
106
|
+
## Resolution
|
|
107
|
+
{Fixed in attempt N | FAILED — escalated}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Step 8 — Write learning (if applicable)**
|
|
111
|
+
If the repair reveals a recurring pattern, write a `[LEARN:bugfix]` entry to `{vault_path}/notes/learnings.md`.
|
|
112
|
+
|
|
113
|
+
## Error Handling
|
|
114
|
+
|
|
115
|
+
| Condition | Action |
|
|
116
|
+
|-----------|--------|
|
|
117
|
+
| No failure output provided | Ask user for error details |
|
|
118
|
+
| Spec issue detected | STOP, redirect to `/discuss` |
|
|
119
|
+
| Fix causes new failure | Revert fix, count as failed attempt |
|
|
120
|
+
| Cannot identify root cause | Count as failed attempt, try different angle |
|
|
121
|
+
|
|
122
|
+
## Callers
|
|
123
|
+
|
|
124
|
+
| Caller | When |
|
|
125
|
+
|--------|------|
|
|
126
|
+
| `/verify` Step 4 | On FAIL — delegates to `/repair` |
|
|
127
|
+
| Manual `/repair` | Any time a fix is needed |
|
|
128
|
+
|
|
129
|
+
## Removal Condition
|
|
130
|
+
Remove when an automated repair agent (e.g., SWE-agent) handles fix-and-verify loops with equivalent quality.
|
|
@@ -28,6 +28,7 @@ Ask: "Review staged changes, last commit, or specific SHA?"
|
|
|
28
28
|
- Any file → `~/.claude/rules/coding.md`
|
|
29
29
|
|
|
30
30
|
**Step 4 — Launch subagent review**
|
|
31
|
+
Follow the subagent dispatch protocol (see `/subagent` skill for reference).
|
|
31
32
|
Launch a subagent with ONLY these inputs (zero conversation history):
|
|
32
33
|
- The diff
|
|
33
34
|
- The SPEC (if available from Step 3)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagent
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: "Reference protocol for subagent dispatch. Defines how to package context, spawn, interpret results, and escalate findings. Not invoked directly — referenced by review, simplify, verify-app, and verify skills."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Subagent Dispatch Protocol
|
|
8
|
+
|
|
9
|
+
This is a reference protocol, not a directly invocable skill. Skills that spawn subagents
|
|
10
|
+
(review, simplify, verify-app, verify) follow this protocol for consistency.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Step 1 — Package Context
|
|
15
|
+
|
|
16
|
+
Subagents receive ONLY these inputs. Zero conversation history.
|
|
17
|
+
|
|
18
|
+
| Input | Source | Required |
|
|
19
|
+
|-------|--------|----------|
|
|
20
|
+
| Diff | `git diff` output scoped to the task | Yes |
|
|
21
|
+
| SPEC | `## SPEC` section from the active plan file | If available |
|
|
22
|
+
| Rules | Relevant `~/.claude/rules/*.md` based on file types in diff | Yes |
|
|
23
|
+
| Project config | Project CLAUDE.md `## Commands` and `## Code Style` | If available |
|
|
24
|
+
|
|
25
|
+
**Never include:**
|
|
26
|
+
- Conversation history
|
|
27
|
+
- User preferences or profile
|
|
28
|
+
- Vault state or session notes
|
|
29
|
+
- Full plan file (only SPEC section)
|
|
30
|
+
|
|
31
|
+
## Step 2 — Define Role
|
|
32
|
+
|
|
33
|
+
One sentence. The role constrains the subagent's perspective.
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
- "You are a critical code reviewer."
|
|
37
|
+
- "You are a code simplification expert."
|
|
38
|
+
- "You are a regression analyst."
|
|
39
|
+
- "You are a security auditor."
|
|
40
|
+
|
|
41
|
+
## Step 3 — Define Task
|
|
42
|
+
|
|
43
|
+
Specific questions or analysis to perform. Include:
|
|
44
|
+
- What to look for (bugs, complexity, regressions, etc.)
|
|
45
|
+
- What NOT to do (don't suggest features, don't change behavior)
|
|
46
|
+
- Scope boundaries (only these files, only this diff)
|
|
47
|
+
|
|
48
|
+
## Step 4 — Define Output Format
|
|
49
|
+
|
|
50
|
+
All subagent findings use this structure:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
{file}:{line} — {severity} — {category} — {description} — {fix}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Severity levels** (consistent across all subagent types):
|
|
57
|
+
- **Critical** — Must fix before proceeding. Blocks merge/ship.
|
|
58
|
+
- **Major** — Should fix before merge. Recommend addressing.
|
|
59
|
+
- **Minor** — Note for future cleanup. Does not block.
|
|
60
|
+
|
|
61
|
+
**If the subagent finds nothing:** Output "No findings." (not an empty list)
|
|
62
|
+
|
|
63
|
+
## Step 5 — Spawn
|
|
64
|
+
|
|
65
|
+
Launch an Agent with:
|
|
66
|
+
- `subagent_type`: use `general-purpose` for review/analysis tasks
|
|
67
|
+
- `prompt`: role + task + inputs + output format
|
|
68
|
+
- Description: short (3-5 words) summary of what the subagent does
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Agent(
|
|
72
|
+
description: "Review diff for bugs",
|
|
73
|
+
prompt: "{role}\n\n{task}\n\n## Diff\n{diff}\n\n## SPEC\n{spec}\n\n## Rules\n{rules}\n\n{output format}"
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Step 6 — Interpret Results
|
|
78
|
+
|
|
79
|
+
Parse the subagent output:
|
|
80
|
+
1. Group findings by severity (Critical → Major → Minor)
|
|
81
|
+
2. Count findings per severity
|
|
82
|
+
3. If output is unparseable: treat entire output as a single Minor finding
|
|
83
|
+
|
|
84
|
+
## Step 7 — Escalate
|
|
85
|
+
|
|
86
|
+
| Severity | Action |
|
|
87
|
+
|----------|--------|
|
|
88
|
+
| Critical (any) | Block. Address immediately before proceeding. |
|
|
89
|
+
| Major (any) | Recommend fixing before merge. |
|
|
90
|
+
| Minor only | Note for future cleanup. Proceed. |
|
|
91
|
+
| No findings | "Clean." Proceed. |
|
|
92
|
+
|
|
93
|
+
**Re-review threshold:** If >3 findings were addressed, re-run the subagent (max 3 rounds).
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Callers
|
|
98
|
+
|
|
99
|
+
| Skill | Subagent Role | Spawned At |
|
|
100
|
+
|-------|---------------|------------|
|
|
101
|
+
| `/review` | Critical code reviewer | Step 4 |
|
|
102
|
+
| `/simplify` | Code simplification expert | Phase 2 |
|
|
103
|
+
| `/verify-app` | Regression analyst | Phase 3 |
|
|
104
|
+
| `/verify` | Critical code reviewer (self-review) | Step 5 |
|
|
105
|
+
| `/repair` | (uses /verify internally, which spawns subagent) | — |
|
|
106
|
+
|
|
107
|
+
## Removal Condition
|
|
108
|
+
Remove when Claude Code provides a native subagent dispatch API with
|
|
109
|
+
structured input/output handling.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync-memory
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: "Bridge auto-memory insights to Obsidian vault. Reads MEMORY.md and topic files, syncs durable entries to vault learnings, prunes stale content. Side-effect skill — never auto-triggers."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# sync-memory Skill
|
|
8
|
+
|
|
9
|
+
You are syncing Claude's auto-memory to the Obsidian vault.
|
|
10
|
+
|
|
11
|
+
## Vault Path Resolution
|
|
12
|
+
Read vault_path from `~/.claude/praxis.config.json`.
|
|
13
|
+
|
|
14
|
+
## Acceptance
|
|
15
|
+
- [ ] MEMORY.md and topic files read
|
|
16
|
+
- [ ] Durable insights synced to vault
|
|
17
|
+
- [ ] Stale entries pruned
|
|
18
|
+
- [ ] MEMORY.md under 80 lines after sync
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
**Step 1 — Locate memory files**
|
|
23
|
+
- Find the auto-memory directory for the current project:
|
|
24
|
+
`~/.claude/projects/-{escaped-cwd}/memory/`
|
|
25
|
+
- Read `MEMORY.md` (the index file)
|
|
26
|
+
- Read all topic files referenced by MEMORY.md (e.g., `user_preferences.md`, `feedback_testing.md`)
|
|
27
|
+
- If no memory files exist: "No auto-memory to sync." Exit.
|
|
28
|
+
|
|
29
|
+
**Step 2 — Classify each entry**
|
|
30
|
+
|
|
31
|
+
For each entry in MEMORY.md and topic files, classify:
|
|
32
|
+
|
|
33
|
+
| Classification | Action |
|
|
34
|
+
|---------------|--------|
|
|
35
|
+
| **Project-specific insight** (error pattern, build quirk, API gotcha) | Append to `vault/notes/learnings.md` as `[LEARN:memory-sync]` |
|
|
36
|
+
| **Global preference** (coding style, tool preference) | Present to user: "Add to CLAUDE.md Error Learning? [entry]" |
|
|
37
|
+
| **Architecture decision** | Present to user: "This belongs in vault specs/ or CLAUDE.md — not MEMORY.md" |
|
|
38
|
+
| **Already in vault** | Skip — note as duplicate |
|
|
39
|
+
| **Stale/outdated** (references deleted files, old versions, resolved bugs) | Mark for pruning |
|
|
40
|
+
| **Machine-specific** (paths, env vars, tool locations) | Keep in MEMORY.md — appropriate for auto-memory |
|
|
41
|
+
|
|
42
|
+
**Step 3 — Sync to vault**
|
|
43
|
+
|
|
44
|
+
For project-specific insights, append to `vault/notes/learnings.md`:
|
|
45
|
+
```markdown
|
|
46
|
+
## [LEARN:memory-sync] [short title]
|
|
47
|
+
- **What**: [the insight]
|
|
48
|
+
- **So What**: [why it matters]
|
|
49
|
+
- **Now What**: [how to apply it]
|
|
50
|
+
- **Date**: [YYYY-MM-DD]
|
|
51
|
+
- **Source**: auto-memory sync
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Step 4 — Prune MEMORY.md**
|
|
55
|
+
|
|
56
|
+
After syncing:
|
|
57
|
+
1. Remove entries that were synced to vault (they now live in the canonical store)
|
|
58
|
+
2. Remove stale/outdated entries
|
|
59
|
+
3. Keep machine-specific and active debugging entries
|
|
60
|
+
4. Verify MEMORY.md is under 80 lines
|
|
61
|
+
5. If still over 80 lines: consolidate further — merge similar entries, shorten descriptions
|
|
62
|
+
|
|
63
|
+
**Step 5 — Report**
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
MEMORY SYNC
|
|
67
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
68
|
+
Synced: [n] entries → vault learnings
|
|
69
|
+
Surfaced: [n] entries for CLAUDE.md review
|
|
70
|
+
Pruned: [n] stale entries removed
|
|
71
|
+
Kept: [n] entries in MEMORY.md
|
|
72
|
+
Lines: [n] / 80 limit
|
|
73
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Error Handling
|
|
77
|
+
|
|
78
|
+
| Condition | Action |
|
|
79
|
+
|-----------|--------|
|
|
80
|
+
| No memory files found | Exit cleanly |
|
|
81
|
+
| Vault path missing | Warn, skip vault sync, still prune |
|
|
82
|
+
| MEMORY.md empty | "Nothing to sync." Exit. |
|
|
83
|
+
| Cannot classify an entry | Keep it — don't prune what you don't understand |
|
|
84
|
+
|
|
85
|
+
## When to Run
|
|
86
|
+
|
|
87
|
+
- Before starting a new kit (`/kit:<name>`)
|
|
88
|
+
- Before `/context-reset` or `/clear`
|
|
89
|
+
- At session end (optional — Stop prompt handles most vault writes)
|
|
90
|
+
- When MEMORY.md exceeds 80 lines
|
|
91
|
+
|
|
92
|
+
## Removal Condition
|
|
93
|
+
Remove when Claude Code provides native memory-to-vault sync or when
|
|
94
|
+
auto-dream learns to respect vault integration boundaries natively.
|
|
@@ -69,12 +69,11 @@ After self-review passes, write phase summary:
|
|
|
69
69
|
- `/simplify` runs after UNIFY, before shipping. It is the quality gate between "it works" and "it's clean".
|
|
70
70
|
|
|
71
71
|
**Step 4 — On FAIL (Stop-and-Fix)**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
5. Write failure details to the active plan file if >1 attempt was needed
|
|
72
|
+
Run `/repair` — it handles the structured fix-and-verify loop:
|
|
73
|
+
- Captures the failure, classifies root cause, attempts up to 3 fixes
|
|
74
|
+
- Re-runs validation after each attempt
|
|
75
|
+
- STOPs with What/So What/Now What after 3 failures
|
|
76
|
+
- Writes repair trace and learnings to vault
|
|
78
77
|
|
|
79
78
|
**Rules:**
|
|
80
79
|
- Never say "tests pass" without showing output.
|
package/kits/api/KIT.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "API design — RESTful conventions, OpenAPI specs, contract testing, endpoint review"
|
|
5
|
+
activation: /kit:api
|
|
6
|
+
deactivation: /kit:off
|
|
7
|
+
skills_chain:
|
|
8
|
+
- phase: spec
|
|
9
|
+
skills: []
|
|
10
|
+
status: planned
|
|
11
|
+
- phase: review
|
|
12
|
+
skills: []
|
|
13
|
+
status: planned
|
|
14
|
+
- phase: contract
|
|
15
|
+
skills: []
|
|
16
|
+
status: planned
|
|
17
|
+
mcp_servers: []
|
|
18
|
+
rules:
|
|
19
|
+
- api-design.md
|
|
20
|
+
removal_condition: >
|
|
21
|
+
Remove when API design is fully handled by a dedicated API gateway or design tool
|
|
22
|
+
with no manual Claude-driven operations remaining.
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# API Kit
|
|
26
|
+
|
|
27
|
+
## Purpose
|
|
28
|
+
Enforce API design best practices across RESTful and GraphQL endpoints.
|
|
29
|
+
Covers spec generation, endpoint review, and contract test scaffolding.
|
|
30
|
+
|
|
31
|
+
## Skills Chain
|
|
32
|
+
|
|
33
|
+
| # | Phase | Command | What It Provides |
|
|
34
|
+
|---|-------|---------|-----------------|
|
|
35
|
+
| 1 | Spec | `/api:spec` | Generate or validate OpenAPI spec from code |
|
|
36
|
+
| 2 | Review | `/api:review` | Endpoint naming, versioning, error codes, auth patterns |
|
|
37
|
+
| 3 | Contract | `/api:contract` | Generate contract tests from OpenAPI spec |
|
|
38
|
+
|
|
39
|
+
## Workflow Integration
|
|
40
|
+
|
|
41
|
+
This kit operates WITHIN the Praxis workflow:
|
|
42
|
+
- **Praxis** structures the work (discuss → plan → execute → verify → simplify → ship)
|
|
43
|
+
- **This kit** adds API-specific rules and commands
|
|
44
|
+
|
|
45
|
+
## Prerequisites
|
|
46
|
+
|
|
47
|
+
Run `install.sh` in this directory to check for required CLI tools.
|
|
48
|
+
Verify with `/kit:api` after install.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Generate contract tests from an OpenAPI spec or route definitions"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# api:contract
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. **Locate spec** — read `docs/openapi.yaml` or detect routes from code
|
|
10
|
+
2. **For each endpoint**, generate a contract test that verifies:
|
|
11
|
+
- Response status code matches expected
|
|
12
|
+
- Response body matches schema
|
|
13
|
+
- Required fields are present
|
|
14
|
+
- Error responses follow the standard format
|
|
15
|
+
3. **Detect test framework** — Jest, pytest, Go testing, etc.
|
|
16
|
+
4. **Write tests** to project test directory
|
|
17
|
+
5. **Run tests** — execute and report results
|
|
18
|
+
6. **Report** — tests generated, pass/fail counts
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Review API endpoints for naming, versioning, error handling, and auth patterns"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# api:review
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. **Identify scope** — review all endpoints, or specific routes if user specifies
|
|
10
|
+
2. **Launch subagent** (follow `/subagent` protocol) with role: "API design reviewer"
|
|
11
|
+
3. **Check against api-design rules:**
|
|
12
|
+
- RESTful naming conventions
|
|
13
|
+
- HTTP status code usage
|
|
14
|
+
- Error response format consistency
|
|
15
|
+
- Authentication/authorization patterns
|
|
16
|
+
- Pagination implementation
|
|
17
|
+
- Versioning strategy
|
|
18
|
+
4. **Present findings** by severity (Critical/Major/Minor)
|
|
19
|
+
5. **Write review** to vault `specs/api-review-{date}.md`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Generate or validate an OpenAPI spec from the current codebase"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# api:spec
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. **Detect API framework** — scan for route definitions (Express, FastAPI, Gin, etc.)
|
|
10
|
+
2. **Extract endpoints** — list all routes with methods, paths, handlers
|
|
11
|
+
3. **Generate OpenAPI 3.x spec** — for each endpoint:
|
|
12
|
+
- Path and method
|
|
13
|
+
- Request parameters (path, query, header)
|
|
14
|
+
- Request body schema (from types/models)
|
|
15
|
+
- Response schemas (success + error)
|
|
16
|
+
- Authentication requirements
|
|
17
|
+
4. **Validate against api-design rules** — flag violations
|
|
18
|
+
5. **Write spec** to `docs/openapi.yaml` (or project-configured location)
|
|
19
|
+
6. **Report** — endpoints found, violations flagged, spec location
|