@esoteric-logic/praxis-harness 2.12.0 → 2.14.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 +31 -4
- package/base/agents/evaluator.md +44 -0
- package/base/agents/planner.md +48 -0
- package/base/configs/registry.json +4 -2
- package/base/hooks/context7-remind.sh +81 -0
- package/base/hooks/settings-hooks.json +9 -0
- package/base/rules/coding.md +7 -0
- package/base/rules/context-budget.md +66 -0
- package/base/rules/context-management.md +4 -0
- package/base/rules/hooks-policy.md +53 -0
- package/base/rules/multi-agent-orchestration.md +99 -0
- package/base/rules/phase-detection.md +52 -0
- package/base/rules/self-repair.md +53 -0
- package/base/rules/session-bridge.md +39 -0
- package/base/rules/session-metrics.md +61 -0
- package/base/rules/skill-authoring.md +85 -0
- package/base/skills/px-compact/SKILL.md +100 -0
- package/base/skills/px-context-probe/SKILL.md +1 -1
- package/base/skills/px-context-triage/SKILL.md +76 -0
- package/base/skills/px-research/SKILL.md +13 -0
- package/kits/api/KIT.md +2 -0
- package/kits/code-quality/KIT.md +2 -0
- package/kits/data/KIT.md +2 -0
- package/kits/infrastructure/KIT.md +2 -0
- package/kits/security/KIT.md +2 -0
- package/kits/web-designer/KIT.md +2 -0
- package/kits/web-designer/rules/web-design.md +13 -2
- package/package.json +1 -1
package/base/CLAUDE.md
CHANGED
|
@@ -62,6 +62,8 @@ All `{vault_path}` references in rules and skills resolve from this config.
|
|
|
62
62
|
- Compact trigger: when context approaches ceiling, finish the current milestone first
|
|
63
63
|
- Never compact mid-plan — complete the milestone, write phase summary to vault, then compact
|
|
64
64
|
- After compaction: re-bootstrap from § After Compaction below, re-run quality checks fresh
|
|
65
|
+
- Context budget: see `~/.claude/rules/context-budget.md` for allocation ratios and cost-conscious loading
|
|
66
|
+
- Mid-session optimization: `/px-compact` (no /clear). Full reset: `/px-context-reset` + `/clear`
|
|
65
67
|
|
|
66
68
|
## Durable Memory
|
|
67
69
|
Context is volatile. Files are permanent. Act accordingly.
|
|
@@ -99,8 +101,14 @@ Registered via `claude mcp add`. Persist globally across sessions.
|
|
|
99
101
|
Check: `claude mcp list` | Manage: `bash scripts/onboard-mcp.sh [server|all]`
|
|
100
102
|
Missing servers are non-blocking — features degrade gracefully.
|
|
101
103
|
|
|
104
|
+
**CLI companions** — invoked via npx, not MCP:
|
|
105
|
+
|
|
106
|
+
| Tool | Purpose | Invoke | Degrades without |
|
|
107
|
+
|------|---------|--------|-----------------|
|
|
108
|
+
| opensrc | Fetch library source for deep inspection | `npx opensrc <package>` | No source-level investigation; Context7 docs only |
|
|
109
|
+
|
|
102
110
|
## After Compaction — Bootstrap
|
|
103
|
-
1. Read project CLAUDE.md (always first)
|
|
111
|
+
1. Read project CLAUDE.md (always first). If `AGENTS.md` exists in project root, read it too — it contains opensrc source manifests.
|
|
104
112
|
2. Active task? → read active plan current milestone only
|
|
105
113
|
No active task? → read `status.md`
|
|
106
114
|
4. Load rules only for what the current task touches:
|
|
@@ -110,7 +118,8 @@ Missing servers are non-blocking — features degrade gracefully.
|
|
|
110
118
|
- Git operation → `~/.claude/rules/git-workflow.md`
|
|
111
119
|
- Client-facing writing → auto-loaded by `px-communication-standards` skill
|
|
112
120
|
- Architecture/specs → auto-loaded by `px-architecture-patterns` skill
|
|
113
|
-
5.
|
|
121
|
+
5. If a triage checkpoint exists (`*-compact-checkpoint.md` with tag `triage`), use its "Active Working Set" to reload files — it is more precise than the hook checkpoint.
|
|
122
|
+
6. Quality re-anchor: read most recent `compact-checkpoint.md` → check the Quality State section.
|
|
114
123
|
- If lint findings existed before compaction: re-run `golangci-lint run`, confirm status.
|
|
115
124
|
- If tests were failing before compaction: re-run test command, confirm status.
|
|
116
125
|
- Do NOT assume pre-compaction state is current. Always re-run fresh.
|
|
@@ -140,12 +149,12 @@ Kits activate via `/px-kit:<n>` slash command. Kits are idempotent — double-ac
|
|
|
140
149
|
| security | `/px-kit:security` | Threat modeling → IAM review → OWASP audit |
|
|
141
150
|
| code-quality | `/px-kit:code-quality` | SAST + secrets + SCA + IaC gate → AI review (over-engineering, smells, structure) |
|
|
142
151
|
| data | `/px-kit:data` | Schema design → migration planning → query optimization |
|
|
143
|
-
|
|
144
152
|
Kit manifests live in `~/.claude/kits/<name>/KIT.md`.
|
|
153
|
+
Kit fields: `context_cost` (low/medium/high), `depends_on` (kit dependencies), `skills_chain` (phased workflow).
|
|
145
154
|
|
|
146
155
|
## Rules Registry — Load on Demand Only
|
|
147
156
|
|
|
148
|
-
### Universal — always active (
|
|
157
|
+
### Universal — always active (16 rules)
|
|
149
158
|
|
|
150
159
|
Quality is a generation-time constraint, not a post-hoc review. The rules below
|
|
151
160
|
are the lens you write through — they shape every line of code produced.
|
|
@@ -166,6 +175,8 @@ are the lens you write through — they shape every line of code produced.
|
|
|
166
175
|
| `~/.claude/rules/security-posture.md` | Sandbox model, credential protection, protected paths |
|
|
167
176
|
| `~/.claude/rules/writing-quality.md` | Prose constraints — sentence limits, fluff kill list, doc templates, voice rules |
|
|
168
177
|
| `~/.claude/rules/refactor-triggers.md` | Pre-check protocol, commit refactor separately, QUALITY: comment convention |
|
|
178
|
+
| `~/.claude/rules/context-budget.md` | Quantitative budget zones, cost-conscious loading, MCP server discipline |
|
|
179
|
+
| `~/.claude/rules/self-repair.md` | Structured recovery — 3-attempt escalation ladder, strategy rotation |
|
|
169
180
|
|
|
170
181
|
### Scoped — load only when paths match
|
|
171
182
|
|
|
@@ -199,6 +210,22 @@ are the lens you write through — they shape every line of code produced.
|
|
|
199
210
|
|------|------------|
|
|
200
211
|
| `~/.claude/rules/observable-code.md` | `**/services/**`, `**/handlers/**`, `**/workers/**`, `**/middleware/**`, `**/cmd/**` |
|
|
201
212
|
|
|
213
|
+
#### Workflow and orchestration
|
|
214
|
+
| File | Loads when |
|
|
215
|
+
|------|------------|
|
|
216
|
+
| `~/.claude/rules/session-bridge.md` | Session start/end, vault handoff, cross-session continuity |
|
|
217
|
+
| `~/.claude/rules/hooks-policy.md` | Adding or modifying hooks in `settings-hooks.json` |
|
|
218
|
+
| `~/.claude/rules/multi-agent-orchestration.md` | Tasks crossing >3 files or multiple domains |
|
|
219
|
+
| `~/.claude/rules/phase-detection.md` | Workflow phase transitions, kit phase changes |
|
|
220
|
+
| `~/.claude/rules/session-metrics.md` | End-of-session retrospective, metrics collection |
|
|
221
|
+
| `~/.claude/rules/skill-authoring.md` | Creating or editing `base/skills/*/SKILL.md` files |
|
|
222
|
+
|
|
223
|
+
#### Agent specs
|
|
224
|
+
| File | Purpose |
|
|
225
|
+
|------|---------|
|
|
226
|
+
| `base/agents/evaluator.md` | Evaluator agent for Generator/Evaluator pattern |
|
|
227
|
+
| `base/agents/planner.md` | Planner agent for task decomposition |
|
|
228
|
+
|
|
202
229
|
### Auto-invocable skills (replace former universal rules)
|
|
203
230
|
| Skill | Triggers when |
|
|
204
231
|
|-------|--------------|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Evaluator Agent Spec
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
You are a critical code evaluator. You score Generator output against a SPEC
|
|
5
|
+
on four dimensions: correctness, completeness, style compliance, and test coverage.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
- **Diff**: staged changes from the Generator
|
|
9
|
+
- **SPEC**: acceptance criteria from the active plan
|
|
10
|
+
- **Rules**: quality rules for file types in the diff
|
|
11
|
+
- **Test output**: test results if available
|
|
12
|
+
|
|
13
|
+
You do NOT have conversation history. Judge the diff on its own merits.
|
|
14
|
+
|
|
15
|
+
## Scoring Rubric
|
|
16
|
+
|
|
17
|
+
| Dimension | Weight | Pass Criteria |
|
|
18
|
+
| --------- | ------ | ------------- |
|
|
19
|
+
| Correctness | 40% | Code does what SPEC says. All paths handled. No logic errors. |
|
|
20
|
+
| Completeness | 25% | All acceptance criteria addressed. No partial implementations. |
|
|
21
|
+
| Style compliance | 20% | Naming, structure, and quality rules respected. |
|
|
22
|
+
| Test coverage | 15% | Happy path, failure path, and edge cases covered. |
|
|
23
|
+
|
|
24
|
+
## Output Format
|
|
25
|
+
|
|
26
|
+
Findings use the standard subagent format:
|
|
27
|
+
```
|
|
28
|
+
{file}:{line} — {severity} — {category} — {description} — {fix}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Severity: Critical (blocks), Major (should fix), Minor (note).
|
|
32
|
+
|
|
33
|
+
End with a summary:
|
|
34
|
+
```
|
|
35
|
+
SCORE: {correctness}% / {completeness}% / {style}% / {tests}%
|
|
36
|
+
VERDICT: PASS | CHANGES_REQUESTED | BLOCK
|
|
37
|
+
FINDINGS: {critical} critical, {major} major, {minor} minor
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Constraints
|
|
41
|
+
- Do not suggest features beyond the SPEC
|
|
42
|
+
- Do not comment on code outside the diff
|
|
43
|
+
- Do not soften findings — be direct about what is wrong
|
|
44
|
+
- If nothing is wrong: "No findings. VERDICT: PASS"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Planner Agent Spec
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
You are a task decomposition planner. You break complex tasks into a dependency-ordered
|
|
5
|
+
subtask graph that a Generator can execute one step at a time.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
- **PROBLEM / DELIVERABLE / ACCEPTANCE / BOUNDARIES** from the discuss phase
|
|
9
|
+
- **Codebase context**: file structure, key interfaces, existing patterns
|
|
10
|
+
- **Active constraints**: quality rules, architecture rules applicable to the task
|
|
11
|
+
|
|
12
|
+
You do NOT have conversation history. Plan from the inputs alone.
|
|
13
|
+
|
|
14
|
+
## Output Format
|
|
15
|
+
|
|
16
|
+
A numbered subtask graph with dependencies:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
SUBTASK GRAPH
|
|
20
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
|
|
22
|
+
1. [subtask title]
|
|
23
|
+
Files: {paths}
|
|
24
|
+
Acceptance: {criteria}
|
|
25
|
+
depends_on: []
|
|
26
|
+
|
|
27
|
+
2. [subtask title]
|
|
28
|
+
Files: {paths}
|
|
29
|
+
Acceptance: {criteria}
|
|
30
|
+
depends_on: [1]
|
|
31
|
+
|
|
32
|
+
3. [subtask title]
|
|
33
|
+
Files: {paths}
|
|
34
|
+
Acceptance: {criteria}
|
|
35
|
+
depends_on: [1, 2]
|
|
36
|
+
|
|
37
|
+
CRITICAL PATH: 1 → 2 → 3
|
|
38
|
+
PARALLELIZABLE: none | {subtask pairs}
|
|
39
|
+
ESTIMATED MILESTONES: {count}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Constraints
|
|
43
|
+
- Each subtask must be completable in a single milestone
|
|
44
|
+
- Each subtask must have testable acceptance criteria
|
|
45
|
+
- Dependencies must be acyclic
|
|
46
|
+
- Do not decompose beyond what is necessary — 3-7 subtasks for most features
|
|
47
|
+
- Flag subtasks that carry architectural risk
|
|
48
|
+
- If the task is simple enough for single-agent mode: say so and output a single subtask
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
{"name": "markdownlint", "feature": "lint-markdown", "install": "npm install -g markdownlint-cli"},
|
|
36
36
|
{"name": "golangci-lint", "feature": "lint-go", "install": "brew install golangci-lint"},
|
|
37
37
|
{"name": "rustfmt", "feature": "format-rust", "install": "rustup component add rustfmt"},
|
|
38
|
-
{"name": "clippy", "feature": "lint-rust", "install": "rustup component add clippy"}
|
|
38
|
+
{"name": "clippy", "feature": "lint-rust", "install": "rustup component add clippy"},
|
|
39
|
+
{"name": "opensrc", "feature": "source-inspection", "install": "npx opensrc@latest --help"}
|
|
39
40
|
]
|
|
40
41
|
},
|
|
41
42
|
"env_vars": {
|
|
@@ -106,7 +107,8 @@
|
|
|
106
107
|
],
|
|
107
108
|
"optional": [
|
|
108
109
|
{"path": "base/hooks/recursion-guard.sh", "event": "PreToolUse", "matcher": "", "feature": "recursion-detection"},
|
|
109
|
-
{"path": "base/hooks/dep-audit.sh", "event": "PostToolUse", "matcher": "Write|Edit|MultiEdit", "feature": "dep-audit"}
|
|
110
|
+
{"path": "base/hooks/dep-audit.sh", "event": "PostToolUse", "matcher": "Write|Edit|MultiEdit", "feature": "dep-audit"},
|
|
111
|
+
{"path": "base/hooks/context7-remind.sh", "event": "PostToolUse", "matcher": "Write|Edit|MultiEdit", "feature": "context7-enforcement"}
|
|
110
112
|
]
|
|
111
113
|
},
|
|
112
114
|
"claude_settings": {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# context7-remind.sh — PostToolUse hook
|
|
3
|
+
# Scans written/edited files for external import statements.
|
|
4
|
+
# Reminds Claude to verify via Context7 if new imports are detected.
|
|
5
|
+
# PostToolUse hooks always exit 0 — this is a reminder, not a gate.
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
trap 'exit 0' ERR
|
|
9
|
+
|
|
10
|
+
INPUT=$(cat)
|
|
11
|
+
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty' 2>/dev/null)
|
|
12
|
+
|
|
13
|
+
if [[ -z "$FILE_PATH" || ! -f "$FILE_PATH" ]]; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Only scan code files where imports are meaningful
|
|
18
|
+
case "$FILE_PATH" in
|
|
19
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs) LANG="js" ;;
|
|
20
|
+
*.py) LANG="py" ;;
|
|
21
|
+
*.go) LANG="go" ;;
|
|
22
|
+
*.rs) LANG="rs" ;;
|
|
23
|
+
*.java) LANG="java" ;;
|
|
24
|
+
*.cs) LANG="cs" ;;
|
|
25
|
+
*) exit 0 ;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
# Build import pattern per language
|
|
29
|
+
case "$LANG" in
|
|
30
|
+
js) PATTERN="^import .+ from ['\"]|require\(['\"]" ;;
|
|
31
|
+
py) PATTERN="^import |^from .+ import " ;;
|
|
32
|
+
go) PATTERN="^import |^\t\"" ;;
|
|
33
|
+
rs) PATTERN="^use [a-z]" ;;
|
|
34
|
+
java) PATTERN="^import " ;;
|
|
35
|
+
cs) PATTERN="^using " ;;
|
|
36
|
+
esac
|
|
37
|
+
|
|
38
|
+
# Extract external imports (skip relative/internal)
|
|
39
|
+
IMPORTS=$(grep -E "$PATTERN" "$FILE_PATH" 2>/dev/null || true)
|
|
40
|
+
|
|
41
|
+
if [[ -z "$IMPORTS" ]]; then
|
|
42
|
+
exit 0
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Filter out internal/relative imports
|
|
46
|
+
EXTERNAL=""
|
|
47
|
+
while IFS= read -r line; do
|
|
48
|
+
case "$LANG" in
|
|
49
|
+
js)
|
|
50
|
+
# Skip relative imports (./ ../)
|
|
51
|
+
if echo "$line" | grep -qE "from ['\"]\."; then continue; fi
|
|
52
|
+
;;
|
|
53
|
+
py)
|
|
54
|
+
# Skip relative imports (from . import, from .. import)
|
|
55
|
+
if echo "$line" | grep -qE "^from \."; then continue; fi
|
|
56
|
+
;;
|
|
57
|
+
go)
|
|
58
|
+
# Skip stdlib (no dots in path) — external modules have dots (github.com, etc.)
|
|
59
|
+
if ! echo "$line" | grep -qE '\"[a-z]+\.[a-z]'; then continue; fi
|
|
60
|
+
;;
|
|
61
|
+
rs)
|
|
62
|
+
# Skip std/crate/self/super
|
|
63
|
+
if echo "$line" | grep -qE "^use (std|crate|self|super)::"; then continue; fi
|
|
64
|
+
;;
|
|
65
|
+
java|cs)
|
|
66
|
+
# Skip java.*/javax.*/System.*
|
|
67
|
+
if echo "$line" | grep -qE "^(import|using) (java\.|javax\.|System\.)"; then continue; fi
|
|
68
|
+
;;
|
|
69
|
+
esac
|
|
70
|
+
EXTERNAL="${EXTERNAL}${line}\n"
|
|
71
|
+
done <<< "$IMPORTS"
|
|
72
|
+
|
|
73
|
+
if [[ -z "$EXTERNAL" ]]; then
|
|
74
|
+
exit 0
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Count unique external packages
|
|
78
|
+
PKG_COUNT=$(echo -e "$EXTERNAL" | grep -c '.' 2>/dev/null || echo "0")
|
|
79
|
+
|
|
80
|
+
echo "CONTEXT7-REMIND: $FILE_PATH contains $PKG_COUNT external import(s). Verify each was looked up via Context7 (resolve-library-id → get-library-docs) this session. If not: do it now before proceeding." >&2
|
|
81
|
+
exit 0
|
package/base/rules/coding.md
CHANGED
|
@@ -29,6 +29,13 @@ Language-specific patterns matched:
|
|
|
29
29
|
Every new external import requires a Context7 verification before the gate clears.
|
|
30
30
|
Internal packages (same repo, same module) are excluded.
|
|
31
31
|
|
|
32
|
+
### Source-level investigation (opensrc)
|
|
33
|
+
- When Context7 docs are insufficient to understand library behavior (bugs, edge cases,
|
|
34
|
+
undocumented internals), run `npx opensrc <package>` to fetch source into `opensrc/<pkg>/`.
|
|
35
|
+
- Before fetching: check `opensrc/sources.json` for already-fetched packages.
|
|
36
|
+
- After fetching: read `AGENTS.md` in project root for the source manifest.
|
|
37
|
+
- This is an escalation path, not a default — Context7 docs are the first stop.
|
|
38
|
+
|
|
32
39
|
### Tool preferences
|
|
33
40
|
- Use Read/Edit/Write tools instead of cat/sed/echo.
|
|
34
41
|
- Use `rg` (ripgrep) for searching code, not grep.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Context Budget — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Quantitative budget for context window usage
|
|
4
|
+
# Companion to context-management.md (qualitative bracket discipline)
|
|
5
|
+
|
|
6
|
+
## Budget Allocation — Invariants (BLOCK on violation)
|
|
7
|
+
|
|
8
|
+
### Zone model
|
|
9
|
+
|
|
10
|
+
The context window is a finite resource. Allocate it deliberately:
|
|
11
|
+
|
|
12
|
+
| Zone | Share | Contents |
|
|
13
|
+
| ---- | ----- | -------- |
|
|
14
|
+
| System overhead | ~15-20% | CLAUDE.md, universal rules, settings, MCP tool schemas |
|
|
15
|
+
| Working content | ~55-65% | Code, plans, conversation, tool output |
|
|
16
|
+
| Reserve | ~20% | Buffer for compaction, final outputs, tool responses |
|
|
17
|
+
|
|
18
|
+
When working content approaches capacity (signals below), begin offloading to vault.
|
|
19
|
+
Never wait for compaction to force the issue.
|
|
20
|
+
|
|
21
|
+
### Budget signals (quantitative bracket thresholds)
|
|
22
|
+
|
|
23
|
+
| Signal | FRESH | MODERATE | DEPLETED |
|
|
24
|
+
| ------ | ----- | -------- | -------- |
|
|
25
|
+
| Tool calls | <15 | 15-35 | 35+ |
|
|
26
|
+
| Files read | <8 | 8-20 | 20+ |
|
|
27
|
+
| Large files (>200 lines) in session | <2 | 2-4 | 5+ |
|
|
28
|
+
| Corrections received | 0 | 1 | 2+ |
|
|
29
|
+
|
|
30
|
+
These thresholds feed `context-management.md` brackets and `/px-context-probe`.
|
|
31
|
+
|
|
32
|
+
## Cost-Conscious Loading — Conventions (WARN on violation)
|
|
33
|
+
|
|
34
|
+
### MCP servers
|
|
35
|
+
- Connect 2-3 core servers at session start (context7, github).
|
|
36
|
+
- Lazy-load optional servers (perplexity, filesystem, sequential-thinking) only when the task requires them.
|
|
37
|
+
- Never connect all registered servers preemptively — each adds schema overhead.
|
|
38
|
+
|
|
39
|
+
### File reads
|
|
40
|
+
- Read targeted line ranges (`offset`/`limit`), not entire files, when you know the section.
|
|
41
|
+
- Files >200 lines: read the relevant section, not the whole file.
|
|
42
|
+
|
|
43
|
+
### Search output
|
|
44
|
+
- Use `files_with_matches` for initial discovery; switch to `content` only for confirmed matches.
|
|
45
|
+
- Delegate exploration expected to produce >50 lines of output to a subagent.
|
|
46
|
+
|
|
47
|
+
## Universal Rule Weight — Conventions (WARN on violation)
|
|
48
|
+
|
|
49
|
+
The 14 universal rules consume ~50KB of every session's context budget.
|
|
50
|
+
|
|
51
|
+
- Before proposing a new universal rule: justify the always-loaded cost.
|
|
52
|
+
- Prefer scoped rules (path-matched) over universal ones when the rule applies to a specific domain.
|
|
53
|
+
- New universal rules must stay under 3KB individually.
|
|
54
|
+
- If a universal rule exceeds 100 lines: split into a short universal rule and a scoped reference file.
|
|
55
|
+
|
|
56
|
+
## Budget Actions
|
|
57
|
+
|
|
58
|
+
| Bracket | Action |
|
|
59
|
+
| ------- | ------ |
|
|
60
|
+
| FRESH | No budget concern. Batch aggressively, load full context. |
|
|
61
|
+
| MODERATE | Prefer concise output. Stop reading whole files. Use subagents for exploration. |
|
|
62
|
+
| DEPLETED | Run `/px-compact` for mid-session optimization, or `/px-context-reset` + `/clear` for full reset. |
|
|
63
|
+
| CRITICAL | STOP new work. Complete current milestone. Write all state to vault. New session. |
|
|
64
|
+
|
|
65
|
+
## Removal Condition
|
|
66
|
+
Remove when Claude Code exposes native token utilization metrics and budget enforcement.
|
|
@@ -72,6 +72,10 @@ conversation length heuristic (not token count — we cannot read session JSONL)
|
|
|
72
72
|
- Write all state to vault immediately
|
|
73
73
|
- Suggest new session for remaining milestones
|
|
74
74
|
|
|
75
|
+
### Budget integration
|
|
76
|
+
See `context-budget.md` for quantitative thresholds and allocation ratios.
|
|
77
|
+
Use `/px-compact` for mid-session optimization; `/px-context-reset` + `/clear` for full reset.
|
|
78
|
+
|
|
75
79
|
---
|
|
76
80
|
|
|
77
81
|
## Verification Commands
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Hooks Policy — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Documents which hooks are mandatory vs optional
|
|
4
|
+
|
|
5
|
+
## Hook Inventory
|
|
6
|
+
|
|
7
|
+
### Mandatory — must not be disabled (BLOCK on violation)
|
|
8
|
+
|
|
9
|
+
| Hook | Event | Purpose |
|
|
10
|
+
| ---- | ----- | ------- |
|
|
11
|
+
| `secret-scan.sh` | PreToolUse: Write/Edit | Blocks credential patterns in code |
|
|
12
|
+
| `credential-guard.sh` | PreToolUse: Bash | Blocks access to protected credential paths |
|
|
13
|
+
| `identity-check.sh` | PreToolUse: Bash | Verifies git identity before commits |
|
|
14
|
+
| `file-guard.sh` | PreToolUse: Write/Edit | Blocks writes to protected file patterns |
|
|
15
|
+
| `vault-checkpoint.sh` | PreCompact | Saves state before context compaction |
|
|
16
|
+
|
|
17
|
+
These hooks are security and data-integrity controls. Disabling them requires
|
|
18
|
+
explicit user approval with documented justification.
|
|
19
|
+
|
|
20
|
+
### Required — should not be disabled without reason (WARN on violation)
|
|
21
|
+
|
|
22
|
+
| Hook | Event | Purpose |
|
|
23
|
+
| ---- | ----- | ------- |
|
|
24
|
+
| `dep-audit.sh` | PostToolUse: Write/Edit | Audits dependencies when manifests change |
|
|
25
|
+
| `session-data-collect.sh` | Stop | Captures session metadata for vault |
|
|
26
|
+
| Stop vault prompt | Stop | Writes session summary and vault updates |
|
|
27
|
+
| `on-stop-failure.sh` | StopFailure | Error handling for failed stop hooks |
|
|
28
|
+
|
|
29
|
+
### Optional — enhance but not required
|
|
30
|
+
|
|
31
|
+
| Hook | Event | Purpose |
|
|
32
|
+
| ---- | ----- | ------- |
|
|
33
|
+
| `auto-format.sh` | PostToolUse: Write/Edit | Auto-formats files after edits |
|
|
34
|
+
| `recursion-guard.sh` | PreToolUse | Prevents recursive tool invocation |
|
|
35
|
+
|
|
36
|
+
## Adding New Hooks
|
|
37
|
+
|
|
38
|
+
Before adding a hook to `settings-hooks.json`:
|
|
39
|
+
1. Classify as mandatory, required, or optional using the criteria above
|
|
40
|
+
2. Mandatory: security or data-integrity function — must never silently fail
|
|
41
|
+
3. Required: workflow quality — should warn on failure but not block
|
|
42
|
+
4. Optional: convenience — can be disabled per-project
|
|
43
|
+
5. All hooks must exit 0 on success, non-zero to block (PreToolUse only)
|
|
44
|
+
6. All hooks must handle missing dependencies gracefully (exit 0 if tool not found)
|
|
45
|
+
|
|
46
|
+
## Hook Configuration
|
|
47
|
+
|
|
48
|
+
Hooks are declared in `base/hooks/settings-hooks.json`.
|
|
49
|
+
Install copies them to `~/.claude/settings.json` during `install.sh`.
|
|
50
|
+
Project-specific hooks can be added in project `.claude/settings.json`.
|
|
51
|
+
|
|
52
|
+
## Removal Condition
|
|
53
|
+
Remove when Claude Code provides a native hook policy/priority system.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Multi-Agent Orchestration — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Governs when and how to use multi-agent patterns
|
|
4
|
+
|
|
5
|
+
## Agent Patterns
|
|
6
|
+
|
|
7
|
+
### Single-Agent (default)
|
|
8
|
+
One Claude instance handles the full task. Subagents handle scoped delegation
|
|
9
|
+
(review, simplify, explore) per the `px-subagent` dispatch protocol.
|
|
10
|
+
|
|
11
|
+
**Use when:** Task touches ≤3 files, single domain, straightforward implementation.
|
|
12
|
+
|
|
13
|
+
### Generator/Evaluator
|
|
14
|
+
Generator produces output. Evaluator critically reviews against spec, scoring on
|
|
15
|
+
correctness, completeness, style compliance, and test coverage.
|
|
16
|
+
|
|
17
|
+
**Use when:** Task touches >5 files, crosses module boundaries, or has high
|
|
18
|
+
correctness requirements (auth, data integrity, public API changes).
|
|
19
|
+
|
|
20
|
+
### Planner/Generator/Evaluator
|
|
21
|
+
Planner decomposes into subtask graph first. Generator and Evaluator work each subtask.
|
|
22
|
+
|
|
23
|
+
**Use when:** Task spans multiple milestones, requires architectural decisions,
|
|
24
|
+
or the plan itself needs adversarial review.
|
|
25
|
+
|
|
26
|
+
## Activation Thresholds — Conventions (WARN on violation)
|
|
27
|
+
|
|
28
|
+
| Signal | Single-Agent | Generator/Evaluator | Planner/Generator/Evaluator |
|
|
29
|
+
| ------ | ------------ | ------------------- | --------------------------- |
|
|
30
|
+
| Files changed | ≤3 | 4-10 | 10+ |
|
|
31
|
+
| Domains crossed | 1 | 2 | 3+ |
|
|
32
|
+
| Milestone count | 1 | 1-2 | 3+ |
|
|
33
|
+
| Risk level | Low | Medium | High |
|
|
34
|
+
|
|
35
|
+
These are guidelines, not hard gates. Use judgment — a 2-file auth change
|
|
36
|
+
may warrant Generator/Evaluator; a 15-file rename may not.
|
|
37
|
+
|
|
38
|
+
## Evaluator Agent Spec
|
|
39
|
+
|
|
40
|
+
When Generator/Evaluator mode is active, the Evaluator receives:
|
|
41
|
+
|
|
42
|
+
| Input | Source |
|
|
43
|
+
| ----- | ------ |
|
|
44
|
+
| Diff | Generator's output (staged changes) |
|
|
45
|
+
| SPEC | From active plan file |
|
|
46
|
+
| Rules | Relevant quality rules for file types in diff |
|
|
47
|
+
| Test output | If tests were run |
|
|
48
|
+
|
|
49
|
+
The Evaluator does NOT receive conversation history.
|
|
50
|
+
|
|
51
|
+
### Evaluator scoring rubric
|
|
52
|
+
|
|
53
|
+
| Dimension | Weight | Criteria |
|
|
54
|
+
| --------- | ------ | -------- |
|
|
55
|
+
| Correctness | 40% | Does the code do what the spec says? All paths handled? |
|
|
56
|
+
| Completeness | 25% | Are all acceptance criteria met? Tests present? |
|
|
57
|
+
| Style compliance | 20% | Naming, structure, quality rules respected? |
|
|
58
|
+
| Test coverage | 15% | Happy path, failure path, edge cases covered? |
|
|
59
|
+
|
|
60
|
+
### Evaluator output format
|
|
61
|
+
Uses the same severity format as `px-subagent`:
|
|
62
|
+
```
|
|
63
|
+
{file}:{line} — {severity} — {category} — {description} — {fix}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Escalation
|
|
67
|
+
- Critical findings → Generator must fix before proceeding
|
|
68
|
+
- Major findings → Generator should fix before merge
|
|
69
|
+
- >3 findings addressed → re-run Evaluator (max 3 rounds)
|
|
70
|
+
|
|
71
|
+
## Planner Agent Spec
|
|
72
|
+
|
|
73
|
+
When Planner mode is active, the Planner receives:
|
|
74
|
+
- PROBLEM / DELIVERABLE / ACCEPTANCE / BOUNDARIES
|
|
75
|
+
- Relevant codebase context (file structure, key interfaces)
|
|
76
|
+
- Active constraints from rules
|
|
77
|
+
|
|
78
|
+
The Planner outputs a subtask graph:
|
|
79
|
+
```
|
|
80
|
+
1. [subtask] — {files} — {acceptance criteria}
|
|
81
|
+
└─ depends_on: []
|
|
82
|
+
2. [subtask] — {files} — {acceptance criteria}
|
|
83
|
+
└─ depends_on: [1]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Generator and Evaluator process each subtask in dependency order.
|
|
87
|
+
|
|
88
|
+
## Integration with Existing Skills
|
|
89
|
+
|
|
90
|
+
| Skill | Orchestration role |
|
|
91
|
+
| ----- | ------------------ |
|
|
92
|
+
| `/px-plan` | May invoke Planner agent for complex decomposition |
|
|
93
|
+
| `/px-review` | Already uses Evaluator pattern via `px-subagent` |
|
|
94
|
+
| `/px-verify` | Self-review step is a lightweight Evaluator |
|
|
95
|
+
| `/px-execute` | Generator role — produces implementation |
|
|
96
|
+
|
|
97
|
+
## Removal Condition
|
|
98
|
+
Remove when Claude Code provides native multi-agent orchestration with
|
|
99
|
+
built-in evaluator and planner agent types.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Phase Detection — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Automatic detection of current workflow phase for adaptive rule loading
|
|
4
|
+
|
|
5
|
+
## Phase Definitions
|
|
6
|
+
|
|
7
|
+
| Phase | Signals | Active Rule Focus |
|
|
8
|
+
| ----- | ------- | ----------------- |
|
|
9
|
+
| **Planning** | `/px-discuss`, `/px-plan`, `/px-spec` invoked; reading specs/plans; no code edits | engineering-judgment, architecture patterns |
|
|
10
|
+
| **Implementing** | Code files being written/edited; tests being written | code-quality, code-excellence, language-specific rules |
|
|
11
|
+
| **Testing** | Test files being run; test output being analyzed | self-verify, observable-code |
|
|
12
|
+
| **Debugging** | `/px-debug` invoked; error analysis; stack traces being read | coding (Context7 mandate), language-specific rules |
|
|
13
|
+
| **Reviewing** | `/px-review`, `/px-simplify` invoked; diff analysis | refactor-triggers, code-quality |
|
|
14
|
+
| **Shipping** | `/px-ship`, `/px-verify` invoked; pre-commit checks | git-workflow, security-posture |
|
|
15
|
+
|
|
16
|
+
## Detection Heuristic — Conventions (WARN on violation)
|
|
17
|
+
|
|
18
|
+
Phase detection is heuristic — infer from the most recent actions:
|
|
19
|
+
|
|
20
|
+
1. **Explicit signal**: A phase-associated skill was invoked → phase is known
|
|
21
|
+
2. **File type signal**: Editing `.ts` files → Implementing. Reading test output → Testing.
|
|
22
|
+
3. **Conversation signal**: Discussing tradeoffs → Planning. Analyzing errors → Debugging.
|
|
23
|
+
|
|
24
|
+
When phase is ambiguous: default to the broader rule set rather than the narrower one.
|
|
25
|
+
Loading extra rules is preferable to missing a constraint.
|
|
26
|
+
|
|
27
|
+
## Adaptive Loading Behavior — Conventions (WARN on violation)
|
|
28
|
+
|
|
29
|
+
### What changes per phase
|
|
30
|
+
- **Planning**: Prioritize engineering-judgment.md, deprioritize language-specific rules
|
|
31
|
+
- **Implementing**: Load language-specific rules for active file types, full code-quality
|
|
32
|
+
- **Reviewing**: Load refactor-triggers.md, emphasize simplicity checks
|
|
33
|
+
- **Shipping**: Load git-workflow.md pre-commit invariants, security-posture checks
|
|
34
|
+
|
|
35
|
+
### What never changes
|
|
36
|
+
Universal rules (14) are always loaded regardless of phase.
|
|
37
|
+
Phase detection adjusts emphasis and attention, not which rules are loaded.
|
|
38
|
+
Claude Code does not support dynamic rule unloading — phase detection shapes
|
|
39
|
+
which rules get actively applied, not which are present in context.
|
|
40
|
+
|
|
41
|
+
## Kit Phase Integration
|
|
42
|
+
|
|
43
|
+
Kits define `skills_chain` with phase fields in their manifests.
|
|
44
|
+
When a kit is active, its phases override the generic phases above:
|
|
45
|
+
- `code-quality` kit: gate → ai-review → self-review
|
|
46
|
+
- `infrastructure` kit: plan → apply → drift → compliance
|
|
47
|
+
- `web-designer` kit: design-system-init → component-build → audit → final-lint
|
|
48
|
+
|
|
49
|
+
Kit phases take precedence when the kit is active.
|
|
50
|
+
|
|
51
|
+
## Removal Condition
|
|
52
|
+
Remove when Claude Code provides native phase-aware rule loading.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Self-Repair — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Structured recovery protocol for repeated failures
|
|
4
|
+
|
|
5
|
+
## Recovery Escalation — Invariants (BLOCK on violation)
|
|
6
|
+
|
|
7
|
+
### Attempt tracking
|
|
8
|
+
Track consecutive failures on the same task. A "failure" is:
|
|
9
|
+
- Test failure after implementation
|
|
10
|
+
- Lint error after fix attempt
|
|
11
|
+
- User correction of the same issue
|
|
12
|
+
- Build failure after code change
|
|
13
|
+
|
|
14
|
+
### Escalation ladder
|
|
15
|
+
|
|
16
|
+
| Attempt | Action |
|
|
17
|
+
| ------- | ------ |
|
|
18
|
+
| 1st failure | Fix the specific error. Re-validate. |
|
|
19
|
+
| 2nd failure (same issue) | Step back. Re-read the relevant code and spec. Try a different approach. |
|
|
20
|
+
| 3rd failure (same issue) | STOP. Report What / So What / Now What. Do not attempt a 4th fix. |
|
|
21
|
+
|
|
22
|
+
This is already in `execution-loop.md` as "Stop-and-Fix Rule." This rule adds
|
|
23
|
+
the structured escalation between attempts.
|
|
24
|
+
|
|
25
|
+
### Strategy rotation on 2nd failure
|
|
26
|
+
When the first fix doesn't work, rotate strategy before retrying:
|
|
27
|
+
|
|
28
|
+
| Failed strategy | Try instead |
|
|
29
|
+
| --------------- | ----------- |
|
|
30
|
+
| Modify existing code | Rewrite the function from scratch |
|
|
31
|
+
| Add logic | Remove logic (simplify) |
|
|
32
|
+
| Fix forward | Revert to last working state, approach differently |
|
|
33
|
+
| Local fix | Check if the problem is upstream (caller, input, config) |
|
|
34
|
+
|
|
35
|
+
### 3rd failure report format
|
|
36
|
+
```
|
|
37
|
+
STOP — REPAIR FAILED
|
|
38
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
39
|
+
What: {exact error after 3 attempts}
|
|
40
|
+
So What: {root cause hypothesis — why all 3 attempts failed}
|
|
41
|
+
Now What: {recommended next step — different approach, user input, or scope change}
|
|
42
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Anti-Patterns — Conventions (WARN on violation)
|
|
46
|
+
|
|
47
|
+
- Do NOT retry the identical fix. If attempt 1 failed, attempt 2 must differ.
|
|
48
|
+
- Do NOT add complexity to fix a failure. If the fix is more complex than the original code, the approach is wrong.
|
|
49
|
+
- Do NOT blame the tooling. If tests fail, the code is likely wrong.
|
|
50
|
+
- Do NOT suppress errors to make validation pass. Fix the root cause.
|
|
51
|
+
|
|
52
|
+
## Removal Condition
|
|
53
|
+
Remove when Claude Code provides native failure tracking and strategy rotation.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Session Bridge — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Protocol for session handoff: end-of-session persist + start-of-session rehydrate
|
|
4
|
+
|
|
5
|
+
## End-of-Session Persist — Invariants (BLOCK on violation)
|
|
6
|
+
|
|
7
|
+
### Mandatory writes before session ends
|
|
8
|
+
1. Update `{vault_path}/status.md` with current What / So What / Now What
|
|
9
|
+
2. Update `{vault_path}/claude-progress.json` with session entry
|
|
10
|
+
3. Write session note to `{vault_path}/notes/{YYYY-MM-DD}_session-note.md`
|
|
11
|
+
|
|
12
|
+
These are already enforced by the Stop hook prompt. This rule makes explicit
|
|
13
|
+
that the vault write is the bridge — conversation state that isn't persisted is lost.
|
|
14
|
+
|
|
15
|
+
## Start-of-Session Rehydrate — Conventions (WARN on violation)
|
|
16
|
+
|
|
17
|
+
### Bootstrap sequence (extends After Compaction § in CLAUDE.md)
|
|
18
|
+
1. Read project CLAUDE.md
|
|
19
|
+
2. Read `{vault_path}/status.md` for loop position and current plan
|
|
20
|
+
3. Read active plan file (current milestone only)
|
|
21
|
+
4. Search vault for context relevant to active task: `rg "{task topic}" {vault_path}/specs/ {vault_path}/notes/`
|
|
22
|
+
5. Load rules scoped to the current task's file types
|
|
23
|
+
|
|
24
|
+
## Cross-Session Continuity — Conventions (WARN on violation)
|
|
25
|
+
|
|
26
|
+
### What survives sessions (via vault)
|
|
27
|
+
- Decisions, specs, ADRs → `{vault_path}/specs/`
|
|
28
|
+
- Session summaries → `{vault_path}/notes/`
|
|
29
|
+
- Learnings → `{vault_path}/notes/learnings.md`
|
|
30
|
+
- Task state → `{vault_path}/status.md`, `claude-progress.json`
|
|
31
|
+
- Plan progress → `{vault_path}/plans/`
|
|
32
|
+
|
|
33
|
+
### What does NOT survive sessions
|
|
34
|
+
- Conversation context (volatile — this is by design)
|
|
35
|
+
- File contents read into context (re-read as needed)
|
|
36
|
+
- Subagent outputs (summarize findings into vault if important)
|
|
37
|
+
|
|
38
|
+
## Removal Condition
|
|
39
|
+
Remove when Claude Code provides native cross-session memory persistence.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Session Metrics — Rules
|
|
2
|
+
# Scope: All projects, all sessions
|
|
3
|
+
# Tracks harness-level performance for self-improvement
|
|
4
|
+
|
|
5
|
+
## Metric Collection — Conventions (WARN on violation)
|
|
6
|
+
|
|
7
|
+
### Metrics captured by existing hooks
|
|
8
|
+
The Stop hook and session-data-collect.sh already capture:
|
|
9
|
+
- Session date and timestamp
|
|
10
|
+
- Branch and last commit
|
|
11
|
+
- Accomplishments (via vault prompt)
|
|
12
|
+
- Corrections count (via session-retro)
|
|
13
|
+
- Learn entries count (via session-retro)
|
|
14
|
+
|
|
15
|
+
### Additional metrics to track (when session-retro runs)
|
|
16
|
+
Append these to the session entry in `claude-progress.json`:
|
|
17
|
+
|
|
18
|
+
| Metric | Source | Purpose |
|
|
19
|
+
| ------ | ------ | ------- |
|
|
20
|
+
| `compaction_count` | Count compact checkpoints for today | How often context exhausted |
|
|
21
|
+
| `files_modified` | `git diff --stat` at session end | Session scope indicator |
|
|
22
|
+
| `milestones_completed` | Plan file milestone checkmarks | Throughput indicator |
|
|
23
|
+
| `repair_attempts` | Count repair traces in vault | Code quality signal |
|
|
24
|
+
| `phase_time` | Estimated split across plan/implement/verify | Bottleneck detection |
|
|
25
|
+
|
|
26
|
+
### Metrics directory
|
|
27
|
+
When session-retro produces structured metrics, write to:
|
|
28
|
+
`{vault_path}/metrics/{YYYY-MM-DD}_session-metrics.md`
|
|
29
|
+
|
|
30
|
+
Format:
|
|
31
|
+
```markdown
|
|
32
|
+
---
|
|
33
|
+
tags: [metrics, session]
|
|
34
|
+
date: YYYY-MM-DD
|
|
35
|
+
source: agent
|
|
36
|
+
---
|
|
37
|
+
# Session Metrics — {YYYY-MM-DD}
|
|
38
|
+
|
|
39
|
+
| Metric | Value |
|
|
40
|
+
| ------ | ----- |
|
|
41
|
+
| Milestones completed | {n} |
|
|
42
|
+
| Files modified | {n} |
|
|
43
|
+
| Compactions | {n} |
|
|
44
|
+
| Repair attempts | {n} |
|
|
45
|
+
| Corrections | {n} |
|
|
46
|
+
| Learnings | {n} |
|
|
47
|
+
| Phase split | Plan {n}% / Implement {n}% / Verify {n}% |
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Pattern Detection — Conventions (WARN on violation)
|
|
51
|
+
|
|
52
|
+
After 5+ sessions with metrics, look for:
|
|
53
|
+
- Debugging consistently >40% of session time → suggest architectural review
|
|
54
|
+
- Compaction count >2 per session → suggest smaller task scoping
|
|
55
|
+
- Repair attempts >3 per session → suggest better spec clarity
|
|
56
|
+
- Corrections >2 per session → suggest context reset or rule update
|
|
57
|
+
|
|
58
|
+
Surface patterns in `/px-session-retro` Phase 7 (Session Health Assessment).
|
|
59
|
+
|
|
60
|
+
## Removal Condition
|
|
61
|
+
Remove when Claude Code provides native session analytics and performance tracking.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Skill Authoring — Rules
|
|
2
|
+
# Scope: Creating or editing base/skills/*/SKILL.md files
|
|
3
|
+
# Codifies agent-first skill design principles
|
|
4
|
+
|
|
5
|
+
## Agent-First Principle
|
|
6
|
+
|
|
7
|
+
The agent is the primary reader of every skill. Design decisions optimize for
|
|
8
|
+
how Claude discovers, loads, and executes a skill — not for how a human browses.
|
|
9
|
+
|
|
10
|
+
## SKILL.md Structure — Invariants (BLOCK on violation)
|
|
11
|
+
|
|
12
|
+
### Frontmatter (required)
|
|
13
|
+
```yaml
|
|
14
|
+
---
|
|
15
|
+
name: px-{skill-name}
|
|
16
|
+
disable-model-invocation: true # false only for auto-trigger skills
|
|
17
|
+
description: "{what it does}. {when to use it}."
|
|
18
|
+
---
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Description as discovery API
|
|
22
|
+
The description field is how Claude selects this skill from 40+ candidates.
|
|
23
|
+
|
|
24
|
+
- Write in third person — descriptions are injected into the system prompt
|
|
25
|
+
- Include BOTH what the skill does AND when to activate it
|
|
26
|
+
- Include trigger keywords the user is likely to say
|
|
27
|
+
- Bad: "Helps with infrastructure" (too vague to discover)
|
|
28
|
+
- Good: "Generates Terraform modules for Azure resources. Use when the user asks to create, modify, or scaffold infrastructure."
|
|
29
|
+
|
|
30
|
+
### Body structure
|
|
31
|
+
- Imperative voice — step-by-step, not conversational
|
|
32
|
+
- Flat structure — one level of headings, no deep nesting
|
|
33
|
+
- Every line must change agent behavior or it's dead weight
|
|
34
|
+
- Under 150 lines — skills over 150 lines should split into a skill + reference file
|
|
35
|
+
|
|
36
|
+
## Degrees of Freedom — Conventions (WARN on violation)
|
|
37
|
+
|
|
38
|
+
Calibrate constraint tightness to operation risk:
|
|
39
|
+
|
|
40
|
+
| Freedom | When | Example skills |
|
|
41
|
+
| ------- | ---- | -------------- |
|
|
42
|
+
| High (text guidance) | Multiple valid paths, creative work | px-discuss, px-review |
|
|
43
|
+
| Medium (templates) | Structured output, consistent format | px-plan, px-session-retro |
|
|
44
|
+
| Low (exact scripts) | Destructive ops, security-sensitive | px-ship, px-secret-scan |
|
|
45
|
+
|
|
46
|
+
### Feedback loops
|
|
47
|
+
Non-trivial skills must include a validate → fix → repeat cycle:
|
|
48
|
+
- Produce intermediate artifact
|
|
49
|
+
- Validate it (test, lint, structural check)
|
|
50
|
+
- Iterate until validation passes
|
|
51
|
+
- Verbose error messages so Claude can self-correct
|
|
52
|
+
|
|
53
|
+
## Naming Convention — Conventions (WARN on violation)
|
|
54
|
+
|
|
55
|
+
- Prefix: `px-` for all Praxis skills
|
|
56
|
+
- Format: short verb or noun — `px-verify`, `px-plan`, `px-debug`
|
|
57
|
+
- Not gerunds — slash commands read better as `/px-verify` than `/px-verifying`
|
|
58
|
+
- Kit skills: `{kit-prefix}:{action}` — `/infra:plan`, `/kg:query`
|
|
59
|
+
|
|
60
|
+
## Boundaries Section — Conventions (WARN on violation)
|
|
61
|
+
|
|
62
|
+
Every skill with side effects must include a `## Boundaries` section:
|
|
63
|
+
- What is explicitly out of scope
|
|
64
|
+
- What the skill must NOT modify
|
|
65
|
+
- Maximum attempts before escalation
|
|
66
|
+
- Whether user approval is required for destructive actions
|
|
67
|
+
|
|
68
|
+
## Progressive Disclosure — Conventions (WARN on violation)
|
|
69
|
+
|
|
70
|
+
- SKILL.md is the entry point — keep it under 150 lines
|
|
71
|
+
- Additional context in reference files one level deep from SKILL.md
|
|
72
|
+
- Prefer executing scripts over reading them into context
|
|
73
|
+
- Name files for content, not sequence: `validation_rules.md` not `doc2.md`
|
|
74
|
+
|
|
75
|
+
## Testing New Skills
|
|
76
|
+
|
|
77
|
+
1. Write the skill
|
|
78
|
+
2. Load it in a fresh session (Claude B)
|
|
79
|
+
3. Invoke with a realistic prompt
|
|
80
|
+
4. Check: Did Claude discover it? Execute it correctly? Follow boundaries?
|
|
81
|
+
5. Tighten constraints where Claude diverged from intent
|
|
82
|
+
|
|
83
|
+
## Removal Condition
|
|
84
|
+
Remove when Claude Code provides a native skill authoring wizard with
|
|
85
|
+
built-in agent-first validation.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: px-compact
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: "Intelligent mid-session compaction. Triages context, checkpoints to vault, triggers compact, reloads working set. Use when DEPLETED but mid-milestone — no /clear needed."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# compact Skill
|
|
8
|
+
|
|
9
|
+
You are performing an intelligent mid-session compaction to free context budget
|
|
10
|
+
while preserving the active working set.
|
|
11
|
+
|
|
12
|
+
**Key difference from `/px-context-reset`:** No `/clear` required. You stay in the
|
|
13
|
+
same session and resume immediately after compaction.
|
|
14
|
+
|
|
15
|
+
## Vault Path Resolution
|
|
16
|
+
|
|
17
|
+
Read vault_path from `~/.claude/praxis.config.json`.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
**Step 1 — Pre-flight check**
|
|
22
|
+
|
|
23
|
+
Assess context bracket from signals (see `context-budget.md` § Budget signals):
|
|
24
|
+
|
|
25
|
+
- **FRESH** → Print: "Context is still fresh. Compaction would lose more than it saves." → STOP.
|
|
26
|
+
- **CRITICAL with no active milestone** → Print: "Context is critically degraded with no active milestone. Use `/px-context-reset` + `/clear` instead." → STOP.
|
|
27
|
+
- **MODERATE/DEPLETED/CRITICAL with active milestone** → Continue.
|
|
28
|
+
|
|
29
|
+
**Step 2 — Triage context**
|
|
30
|
+
|
|
31
|
+
Classify all loaded context into priority tiers:
|
|
32
|
+
|
|
33
|
+
| Tier | Action |
|
|
34
|
+
| ---- | ------ |
|
|
35
|
+
| T1: Active working set (current file, active milestone, failing tests) | Keep — reload after compact |
|
|
36
|
+
| T2: Decision context (SPEC, constraints, last 3 decisions) | Keep — include in checkpoint |
|
|
37
|
+
| T3: Session history (earlier discussion, exploration, superseded approaches) | Offload summaries to vault |
|
|
38
|
+
| T4: Reference material (docs consumed, examples applied) | Drop |
|
|
39
|
+
|
|
40
|
+
For T3 items with decision value: append summaries to `{vault_path}/plans/{YYYY-MM-DD}-triage-offload.md`.
|
|
41
|
+
|
|
42
|
+
**Step 3 — Write compact checkpoint**
|
|
43
|
+
|
|
44
|
+
Write `{vault_path}/plans/{YYYY-MM-DD}-compact-checkpoint.md`:
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
---
|
|
48
|
+
tags: [checkpoint, compact, triage]
|
|
49
|
+
date: {YYYY-MM-DD}
|
|
50
|
+
source: agent
|
|
51
|
+
---
|
|
52
|
+
# Compact Checkpoint — {YYYY-MM-DD HH:MM}
|
|
53
|
+
|
|
54
|
+
## Active Working Set (reload after compact)
|
|
55
|
+
- File: {path} — {what you are doing with it}
|
|
56
|
+
- File: {path} — {what you are doing with it}
|
|
57
|
+
|
|
58
|
+
## Current Milestone
|
|
59
|
+
{milestone name from active plan}
|
|
60
|
+
|
|
61
|
+
## Decisions (last 3)
|
|
62
|
+
1. {decision} — {rationale}
|
|
63
|
+
2. {decision} — {rationale}
|
|
64
|
+
3. {decision} — {rationale}
|
|
65
|
+
|
|
66
|
+
## Offloaded This Session
|
|
67
|
+
See: plans/{YYYY-MM-DD}-triage-offload.md
|
|
68
|
+
|
|
69
|
+
## Next Step After Compact
|
|
70
|
+
{exact next action — be specific}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Step 4 — Update vault state**
|
|
74
|
+
|
|
75
|
+
1. Update `{vault_path}/status.md` — refresh What / So What / Now What
|
|
76
|
+
2. Update `{vault_path}/claude-progress.json` — add session entry with `"source": "compact"`
|
|
77
|
+
|
|
78
|
+
**Step 5 — Trigger compaction**
|
|
79
|
+
|
|
80
|
+
Print the bootstrap instructions first:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Compact checkpoint saved. Triggering compaction.
|
|
84
|
+
|
|
85
|
+
After compaction, re-bootstrap:
|
|
86
|
+
1. Read {vault_path}/plans/{YYYY-MM-DD}-compact-checkpoint.md
|
|
87
|
+
2. Read the active plan: {plan-filename}, milestone: {milestone-name}
|
|
88
|
+
3. Re-read only files listed in "Active Working Set" above
|
|
89
|
+
4. Resume: {next step}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then run `/compact` (Claude Code built-in).
|
|
93
|
+
|
|
94
|
+
**Note:** The PreCompact hook (`vault-checkpoint.sh`) will also fire and write its own
|
|
95
|
+
checkpoint. The triage checkpoint from Step 3 is authoritative — it contains the
|
|
96
|
+
curated working set. The hook checkpoint is a safety net.
|
|
97
|
+
|
|
98
|
+
## Removal Condition
|
|
99
|
+
|
|
100
|
+
Remove when Claude Code provides native intelligent compaction with working set preservation.
|
|
@@ -26,7 +26,7 @@ Assess these indicators (do NOT read external files just for this — use what y
|
|
|
26
26
|
| Compaction occurred | Did you receive a compaction bootstrap? |
|
|
27
27
|
| Active task complexity | Simple (1-2 files) vs complex (5+ files, multi-milestone) |
|
|
28
28
|
|
|
29
|
-
**Step 2 — Estimate bracket**
|
|
29
|
+
**Step 2 — Estimate bracket** (quantitative thresholds: see `context-budget.md` § Budget signals)
|
|
30
30
|
|
|
31
31
|
| Bracket | Signals | Action |
|
|
32
32
|
|---------|---------|--------|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: px-context-triage
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
description: "Prioritize context contents: what to keep, what to offload to vault, what to drop. Use before compaction or when context bracket is DEPLETED."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# context-triage Skill
|
|
8
|
+
|
|
9
|
+
You are triaging context contents to free budget for continued work.
|
|
10
|
+
|
|
11
|
+
## Vault Path Resolution
|
|
12
|
+
|
|
13
|
+
Read vault_path from `~/.claude/praxis.config.json`.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Step 1 — Inventory current context**
|
|
18
|
+
|
|
19
|
+
From memory (do NOT read files just for inventory), list what is loaded:
|
|
20
|
+
|
|
21
|
+
| Category | Examples |
|
|
22
|
+
| -------- | -------- |
|
|
23
|
+
| Code files read/edited | Source files, configs, tests |
|
|
24
|
+
| Plan/spec files | Active plan, SPEC, ADRs |
|
|
25
|
+
| Conversation topics | Discussion threads, decisions, corrections |
|
|
26
|
+
| Reference material | Docs read, research, examples already applied |
|
|
27
|
+
| MCP connections | Which servers are active |
|
|
28
|
+
|
|
29
|
+
**Step 2 — Classify by priority tier**
|
|
30
|
+
|
|
31
|
+
| Tier | Rule | Examples |
|
|
32
|
+
| ---- | ---- | -------- |
|
|
33
|
+
| T1: Active working set | Always keep | File being edited, active plan milestone, failing test output |
|
|
34
|
+
| T2: Decision context | Keep if FRESH/MODERATE | SPEC, architectural constraints, last 3 decisions |
|
|
35
|
+
| T3: Session history | Offload to vault | Earlier discussion, exploration results, superseded approaches |
|
|
36
|
+
| T4: Reference material | Drop | Docs already consumed, examples already applied |
|
|
37
|
+
|
|
38
|
+
**Step 3 — Offload T3/T4 to vault**
|
|
39
|
+
|
|
40
|
+
For each T3/T4 item that contains decisions or state worth preserving:
|
|
41
|
+
|
|
42
|
+
1. Append to `{vault_path}/plans/{YYYY-MM-DD}-triage-offload.md` (create if needed, append if exists)
|
|
43
|
+
2. Format per item: date, item name, 1-2 line summary, file references if applicable
|
|
44
|
+
3. Add YAML frontmatter if creating new file:
|
|
45
|
+
```yaml
|
|
46
|
+
---
|
|
47
|
+
tags: [triage, offload]
|
|
48
|
+
date: YYYY-MM-DD
|
|
49
|
+
source: agent
|
|
50
|
+
---
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Items with no decision value (pure reference, already applied) — drop without saving.
|
|
54
|
+
|
|
55
|
+
**Step 4 — Report**
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
CONTEXT TRIAGE
|
|
59
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
60
|
+
Keeping: {count} items (T1/T2)
|
|
61
|
+
Offloaded: {count} items to vault
|
|
62
|
+
Dropped: {count} items (no state value)
|
|
63
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Step 5 — Recommend next action**
|
|
67
|
+
|
|
68
|
+
| Bracket | Recommendation |
|
|
69
|
+
| ------- | -------------- |
|
|
70
|
+
| FRESH/MODERATE | Triage complete. No compaction needed yet. |
|
|
71
|
+
| DEPLETED | Run `/px-compact` now for mid-session optimization. |
|
|
72
|
+
| CRITICAL | Run `/px-context-reset` + `/clear` for full reset. |
|
|
73
|
+
|
|
74
|
+
## Removal Condition
|
|
75
|
+
|
|
76
|
+
Remove when Claude Code provides native context budget visibility and automatic triage.
|
|
@@ -62,6 +62,16 @@ Use `perplexity_search` (model: `sonar` for speed):
|
|
|
62
62
|
- Query: `"[package] last commit release 2025 2026 archived"`
|
|
63
63
|
- Extract: last commit date, last release date, repository status, contributor count
|
|
64
64
|
|
|
65
|
+
## Step 5.5 — Source Fetch (optional, on `--deep` flag or when investigating internals)
|
|
66
|
+
|
|
67
|
+
If the research is for understanding implementation behavior (not just API surface):
|
|
68
|
+
1. Check `opensrc/sources.json` — skip if package already fetched
|
|
69
|
+
2. Run `npx opensrc <package>` to fetch source into `opensrc/<pkg>/`
|
|
70
|
+
3. Read `AGENTS.md` for the source manifest
|
|
71
|
+
4. Note key implementation details in the report under a new "### Implementation Notes" section
|
|
72
|
+
|
|
73
|
+
Skip this step for standard dependency evaluation (version/CVE/maintenance checks).
|
|
74
|
+
|
|
65
75
|
## Step 6 — Produce Report
|
|
66
76
|
|
|
67
77
|
Output in this exact format:
|
|
@@ -81,6 +91,9 @@ Output in this exact format:
|
|
|
81
91
|
### API Notes (from live docs)
|
|
82
92
|
[Relevant API surface, configuration, or usage patterns from Context7/Sonar docs]
|
|
83
93
|
|
|
94
|
+
### Implementation Notes (when source was fetched)
|
|
95
|
+
[Key internals, edge cases, or undocumented behavior discovered from source]
|
|
96
|
+
|
|
84
97
|
### Sources
|
|
85
98
|
- [Citation URL 1]
|
|
86
99
|
- [Citation URL 2]
|
package/kits/api/KIT.md
CHANGED
package/kits/code-quality/KIT.md
CHANGED
|
@@ -4,6 +4,8 @@ version: 1.0.0
|
|
|
4
4
|
description: "Code quality enforcement — parallel deterministic gate (SAST, secrets, SCA, IaC) + AI review layer (over-engineering, smells, structure, performance)"
|
|
5
5
|
activation: /kit:code-quality
|
|
6
6
|
deactivation: /kit:off
|
|
7
|
+
context_cost: high
|
|
8
|
+
depends_on: []
|
|
7
9
|
skills_chain:
|
|
8
10
|
- phase: gate
|
|
9
11
|
skills: [sast-scan, secrets-scan, sca-scan, iac-scan]
|
package/kits/data/KIT.md
CHANGED
package/kits/security/KIT.md
CHANGED
package/kits/web-designer/KIT.md
CHANGED
|
@@ -13,6 +13,8 @@ skills_chain:
|
|
|
13
13
|
skills: [web-accessibility, ui-skills-baseline, ui-skills-motion]
|
|
14
14
|
- phase: final-lint
|
|
15
15
|
skills: [web-design-guidelines]
|
|
16
|
+
context_cost: medium
|
|
17
|
+
depends_on: []
|
|
16
18
|
mcp_servers:
|
|
17
19
|
- name: 21st-magic
|
|
18
20
|
command: npx -y @21st-dev/magic@latest
|
|
@@ -9,25 +9,30 @@ paths:
|
|
|
9
9
|
- "design-system/**"
|
|
10
10
|
- "styles/**"
|
|
11
11
|
---
|
|
12
|
+
|
|
12
13
|
# Web Design — Rules
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
Scope: Frontend component and design system files.
|
|
16
|
+
Part of: web-designer AI-Kit.
|
|
15
17
|
|
|
16
18
|
## Invariants (BLOCK on violation)
|
|
17
19
|
|
|
18
20
|
### Design Tokens
|
|
21
|
+
|
|
19
22
|
- No inline styles in component files — use design tokens or Tailwind utilities.
|
|
20
23
|
- No hardcoded color values (`#fff`, `rgb(...)`) — must reference token variables
|
|
21
24
|
(`var(--color-primary)`, Tailwind classes, or theme values).
|
|
22
25
|
- Check: `grep -rn "color:" src/components/ | grep -v "var(--" | grep -v "tailwind"`
|
|
23
26
|
|
|
24
27
|
### Semantic HTML
|
|
28
|
+
|
|
25
29
|
- No `<div>` click handlers — use `<button>` for actions, `<a>` for navigation.
|
|
26
30
|
- Check: `grep -rn 'onClick.*<div' src/components/`
|
|
27
31
|
- Every interactive element must have explicit keyboard handling (`onKeyDown` or
|
|
28
32
|
native keyboard support via semantic elements).
|
|
29
33
|
|
|
30
34
|
### Accessibility
|
|
35
|
+
|
|
31
36
|
- Every `<img>` must have an `alt` attribute (empty `alt=""` for decorative images).
|
|
32
37
|
- Form inputs must have associated `<label>` elements or `aria-label`.
|
|
33
38
|
- Color contrast must meet WCAG AA minimum (4.5:1 for text, 3:1 for large text).
|
|
@@ -35,6 +40,7 @@ paths:
|
|
|
35
40
|
## Conventions (WARN on violation)
|
|
36
41
|
|
|
37
42
|
### Component Structure
|
|
43
|
+
|
|
38
44
|
- Component files follow `ComponentName/index.tsx` + `ComponentName.module.css`
|
|
39
45
|
(or `ComponentName.tsx` with Tailwind — pick one pattern per project, don't mix).
|
|
40
46
|
- Design tokens live in `design-system/tokens/` or equivalent.
|
|
@@ -42,21 +48,25 @@ paths:
|
|
|
42
48
|
live in `src/components/[page-name]/`.
|
|
43
49
|
|
|
44
50
|
### Animation and Motion
|
|
51
|
+
|
|
45
52
|
- Animation durations use token values, not magic numbers.
|
|
46
53
|
- Respect `prefers-reduced-motion` — wrap animations in media query.
|
|
47
54
|
- CSS transitions preferred over JS animation libraries for simple effects.
|
|
48
55
|
|
|
49
56
|
### Performance
|
|
57
|
+
|
|
50
58
|
- Images have explicit `width` and `height` to prevent CLS (Cumulative Layout Shift).
|
|
51
59
|
- Lazy-load images below the fold (`loading="lazy"`).
|
|
52
60
|
- No layout-triggering CSS in animation loops (`top`, `left`, `width`, `height` — use `transform` and `opacity`).
|
|
53
61
|
|
|
54
62
|
### Design System Hygiene
|
|
63
|
+
|
|
55
64
|
- New components must use existing tokens before creating new ones.
|
|
56
65
|
- If a new token is needed: add to the token file, not inline.
|
|
57
66
|
- Component variants use a consistent API pattern (props, not className overrides).
|
|
58
67
|
|
|
59
68
|
## Verification Commands
|
|
69
|
+
|
|
60
70
|
```bash
|
|
61
71
|
# Token compliance — find hardcoded colors
|
|
62
72
|
grep -rn "color:" src/components/ | grep -v "var(--" | grep -v "token" | grep -v "tailwind"
|
|
@@ -75,5 +85,6 @@ npx axe-core src/ --exit
|
|
|
75
85
|
```
|
|
76
86
|
|
|
77
87
|
## Removal Condition
|
|
88
|
+
|
|
78
89
|
Remove when the project's design system is mature with >90% component coverage
|
|
79
90
|
and design review is handled by a dedicated design tool or CI pipeline.
|
package/package.json
CHANGED