start-vibing-stacks 2.14.0 → 2.15.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/package.json +1 -1
- package/stacks/_shared/commands/feature.md +21 -9
- package/stacks/_shared/commands/fix.md +20 -6
- package/stacks/_shared/commands/research.md +18 -7
- package/stacks/_shared/commands/validate.md +31 -4
- package/stacks/_shared/skills/codebase-knowledge/SKILL.md +46 -49
- package/stacks/_shared/skills/codebase-knowledge/TEMPLATE.md +35 -14
- package/stacks/_shared/skills/docs-tracker/SKILL.md +83 -35
- package/stacks/_shared/skills/research-cache/SKILL.md +112 -35
package/package.json
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feature
|
|
3
|
+
description: Start a new feature with the full workflow (research → plan → implement → test → security → quality → commit → docs).
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# /feature — Start New Feature
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
Always read `.claude/config/active-project.json` first to know the active stack.
|
|
10
|
+
|
|
11
|
+
Execute in order — do not skip steps. Steps 5–6 have **VETO power** over commit.
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
| # | Step | Agent / Skill |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| 1 | **Research** (only for new tech / patterns) | `research-web` |
|
|
16
|
+
| 2 | **Plan** — break into tasks, create TODO list | (you, in plan mode) |
|
|
17
|
+
| 3 | **Implement** — follow stack patterns + strict types | (you) |
|
|
18
|
+
| 4 | **Test** — unit + e2e | `tester` |
|
|
19
|
+
| 5 | **Security** — adversarial audit | `security-auditor` (VETO) |
|
|
20
|
+
| 6 | **Quality** — typecheck → lint → test → build | `quality-gate` |
|
|
21
|
+
| 7 | **Commit** — gate-aware, diff-driven message | `commit-manager` |
|
|
22
|
+
| 8 | **Map** — files + commits → domains | `documenter` |
|
|
23
|
+
| 9 | **Wisdom + Last Change** — record learnings, refresh `CLAUDE.md` | `domain-updater` |
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
If `security-auditor` returns CRITICAL/HIGH/MEDIUM, fix before re-running step 5. Steps 8–9 run AFTER push and never before.
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix
|
|
3
|
+
description: Fix a bug — reproduce, isolate, minimal fix, regression test, security check, commit, record wisdom.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# /fix — Fix Bug
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
Always read `.claude/config/active-project.json` first.
|
|
10
|
+
|
|
11
|
+
| # | Step | Agent / Skill |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| 1 | **Reproduce** — read the error, reproduce locally, isolate the root cause (NOT the symptom) | (you) |
|
|
14
|
+
| 2 | **Failing test first** — write a regression test that proves the bug | `tester` |
|
|
15
|
+
| 3 | **Apply minimal fix** — do not refactor adjacent code in the same commit | (you) |
|
|
16
|
+
| 4 | **Verify** — re-run the regression test + the wider suite | `tester` |
|
|
17
|
+
| 5 | **Security** — only if the bug touched auth / input / secrets / SSRF surface | `security-auditor` (VETO) |
|
|
18
|
+
| 6 | **Quality gate** — typecheck → lint → test → build | `quality-gate` |
|
|
19
|
+
| 7 | **Commit** — `fix(scope): <subject>`, diff-driven body | `commit-manager` |
|
|
20
|
+
| 8 | **Map** — files + commit → domain | `documenter` |
|
|
21
|
+
| 9 | **Wisdom** — append to domain `## Problems & Solutions` (symptom + root cause + fix + prevention + skill ref) | `domain-updater` |
|
|
4
22
|
|
|
5
|
-
|
|
6
|
-
2. **Fix** → Apply minimal fix
|
|
7
|
-
3. **Test** → Add regression test (tester agent)
|
|
8
|
-
4. **Document** → Record in domain Problems & Solutions
|
|
9
|
-
5. **Commit** → commit-manager agent
|
|
23
|
+
`domain-updater` deduplicates by symptom/root-cause. If the same bug recurred, it appends a "Recurrence" note instead of a duplicate entry.
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: Research best practices using research-web (MCP-first) with cache lookup before any web call.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# /research — Research Best Practices
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
Always read `.claude/config/active-project.json` first to know the active stack.
|
|
10
|
+
|
|
11
|
+
| # | Step | Tool / Skill |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| 1 | **Cache lookup** — check `.claude/skills/research-cache/cache/<topic>.md` first. If fresh (≤ 30 days), use it and skip steps 2–5 | `research-cache` |
|
|
14
|
+
| 2 | **MCP probe** — detect `mcp__web-scraper__*` availability (one-shot per session) | `research-web` |
|
|
15
|
+
| 3 | **Search** — Tier 1: `unified_search` (Brave + Vertex AI + Grok, dedupe + scoring). Tier 2 fallback: built-in `WebSearch` | `research-web` |
|
|
16
|
+
| 4 | **Source ranking** — official docs > engineering blogs > GitHub issues > Stack Overflow. Reject anything > 18 months old without re-validation | (you) |
|
|
17
|
+
| 5 | **Deep read** — Tier 1: `scrape_url` (stealth + proxy). Tier 2 fallback: built-in `WebFetch` | `research-web` |
|
|
18
|
+
| 6 | **Document** — write `.claude/skills/research-cache/cache/<topic>.md` with: date · expiry (now + 30 days) · sources · TL;DR · actionable rules | `research-cache` |
|
|
19
|
+
| 7 | **Promote** — if any rule applies project-wide, propose adding it to `CLAUDE.md` (do NOT auto-edit; surface the proposal) | (you) |
|
|
4
20
|
|
|
5
|
-
|
|
6
|
-
2. **Search web** → "[topic] best practices [year] [stack]"
|
|
7
|
-
3. **Sources**: Official docs > Engineering blogs > OWASP > GitHub issues
|
|
8
|
-
4. **Document** → Create `.claude/skills/research-cache/cache/[topic].md`
|
|
9
|
-
5. **Extract rules** → Add actionable rules to CLAUDE.md if applicable
|
|
10
|
-
6. **Update cache** → Date + expiry (30 days)
|
|
21
|
+
Each cache entry has frontmatter `expires_on:` so a future session can detect stale notes without re-reading the body.
|
|
@@ -1,10 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: validate
|
|
3
|
+
description: Run the full quality gate (typecheck → lint → test → build) using the stack's commands from active-project.json.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# /validate — Run Full Validation
|
|
2
8
|
|
|
3
|
-
Read quality gates from `.claude/config/active-project.json` and run
|
|
9
|
+
Read the quality gates from `.claude/config/active-project.json#qualityGates` and run them in order. Stop at the first failure.
|
|
4
10
|
|
|
5
11
|
```bash
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
jq -r '.qualityGates' .claude/config/active-project.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Execution order (each step blocks the next):
|
|
16
|
+
|
|
17
|
+
| # | Gate | Typical commands |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| 1 | **Typecheck** | `npx tsc --noEmit` · `mypy .` · `vendor/bin/phpstan analyse` |
|
|
20
|
+
| 2 | **Lint** | `npx eslint .` · `ruff check .` · `vendor/bin/pint --test` |
|
|
21
|
+
| 3 | **Unit tests** | `npx vitest run` · `pytest` · `vendor/bin/phpunit` |
|
|
22
|
+
| 4 | **E2E** (only if configured) | `npx playwright test` |
|
|
23
|
+
| 5 | **Build** | `npm run build` · `composer dump-autoload --optimize` |
|
|
24
|
+
|
|
25
|
+
Output format (one line per gate):
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
typecheck: PASS (1.4s)
|
|
29
|
+
lint: PASS (0.8s)
|
|
30
|
+
tests: PASS (45/45 in 6.2s)
|
|
31
|
+
e2e: SKIP (not configured)
|
|
32
|
+
build: PASS (3.1s)
|
|
33
|
+
|
|
34
|
+
✅ All gates passed — safe to invoke commit-manager
|
|
8
35
|
```
|
|
9
36
|
|
|
10
|
-
|
|
37
|
+
If any gate fails, print the failure output and exit non-zero. `commit-manager` will refuse to commit while validation is failing.
|
|
@@ -1,71 +1,68 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codebase-knowledge
|
|
3
|
-
version:
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "Cached domain knowledge consumed BEFORE implementing any feature. Reads `.claude/skills/codebase-knowledge/_index.json` (machine-readable, regenerated by `documenter`) for fast filter, then reads only the affected `domains/<slug>.md` files. Avoids re-exploring the codebase every session."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Codebase Knowledge — Domain
|
|
7
|
+
# Codebase Knowledge — Domain Knowledge Reader (v2.0.0)
|
|
7
8
|
|
|
8
9
|
**ALWAYS invoke BEFORE implementing any feature.**
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
This skill is the **read side** of the project memory layer maintained by the `documenter` and `domain-updater` agents. Its job is to load just enough context for the next change without re-discovering the whole codebase.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Domain Files Location
|
|
13
|
+
## Storage layout (maintained by `documenter` v2.0.0)
|
|
15
14
|
|
|
16
15
|
```
|
|
17
|
-
.claude/skills/codebase-knowledge/
|
|
18
|
-
├──
|
|
19
|
-
├──
|
|
20
|
-
├──
|
|
21
|
-
├──
|
|
22
|
-
└──
|
|
16
|
+
.claude/skills/codebase-knowledge/
|
|
17
|
+
├── SKILL.md # this file
|
|
18
|
+
├── TEMPLATE.md # template for new domain files (no version — it is a template)
|
|
19
|
+
├── _INDEX.md # human-readable list of all domains
|
|
20
|
+
├── _index.json # machine-readable index — SOURCE OF TRUTH for filter
|
|
21
|
+
└── domains/
|
|
22
|
+
├── <slug>.md # one file per domain. ≤ 8 KB / ~2k tokens / 200 lines
|
|
23
|
+
└── <slug>.archive.md # commits/wisdom older than the cap (read on demand only)
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
```markdown
|
|
28
|
-
# {Domain Name}
|
|
26
|
+
## Read protocol (token-efficient)
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
| # | Step | Tool |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| 1 | **Resolve which domain(s) you need** by glob/grep on the affected file paths against `.claude/config/domain-mapping.json` | Bash + jq |
|
|
31
|
+
| 2 | **Read `_index.json` first** — one query gives you `last_commit`, `tags`, `connections` for every domain | `jq '.domains[] \| select(.slug == "auth")' _index.json` |
|
|
32
|
+
| 3 | **Read only the matched `domains/<slug>.md`** files — never `cat domains/*.md` (that defeats the budget) | Read |
|
|
33
|
+
| 4 | **Follow `connections`** if the change crosses a domain boundary; read those neighbours too | Read |
|
|
34
|
+
| 5 | **Skip `<slug>.archive.md`** unless `_index.json` flags `status: archived` and you actually need history | Read |
|
|
34
35
|
|
|
35
|
-
##
|
|
36
|
-
| File | Purpose |
|
|
37
|
-
|------|---------|
|
|
38
|
-
| `path/file.ext` | Description |
|
|
36
|
+
## Domain file shape
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
| Domain | How They Connect |
|
|
42
|
-
|--------|-----------------|
|
|
43
|
-
| auth | Validates tokens before API calls |
|
|
38
|
+
Defined by `documenter` v2.0.0 — see `TEMPLATE.md` in this folder for the canonical layout. Required sections:
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
## Problems & Solutions
|
|
54
|
-
### Problem Title
|
|
55
|
-
**Problem:** What went wrong
|
|
56
|
-
**Solution:** How it was fixed
|
|
57
|
-
**Prevention:** How to avoid in future
|
|
58
|
-
```
|
|
40
|
+
- YAML frontmatter (`domain · tags · owner · last_commit · last_date · files_count · connections · status`)
|
|
41
|
+
- TL;DR (≤ 3 lines, front-loads boundary)
|
|
42
|
+
- Files table (path → role)
|
|
43
|
+
- Connections table (bidirectional: → and ← rows)
|
|
44
|
+
- Recent Commits (capped at 20)
|
|
45
|
+
- Attention Points (capped at 10)
|
|
46
|
+
- Problems & Solutions (capped at 5, append-only)
|
|
59
47
|
|
|
60
48
|
## Workflow
|
|
61
49
|
|
|
62
|
-
1. **Before coding**
|
|
63
|
-
2. **During coding**
|
|
64
|
-
3. **After
|
|
50
|
+
1. **Before coding** — read this skill, then `_index.json`, then the affected `domains/<slug>.md` files.
|
|
51
|
+
2. **During coding** — note any new connection, gotcha, or non-obvious decision (you do not write here directly).
|
|
52
|
+
3. **After commit** — `documenter` maps files+commits, `domain-updater` records the wisdom you collected.
|
|
65
53
|
|
|
66
54
|
## Rules
|
|
67
55
|
|
|
68
|
-
1. **
|
|
69
|
-
2. **
|
|
70
|
-
3. **
|
|
71
|
-
4. **
|
|
56
|
+
1. **READ `_index.json` FIRST** — it is regenerated each commit; it is the cheapest way to filter.
|
|
57
|
+
2. **NEVER `cat domains/*.md`** — you will blow the context budget.
|
|
58
|
+
3. **BIDIRECTIONAL CONNECTIONS** — if `auth.md` lists `→ api`, then `api.md` MUST list `← auth`. If you spot a missing reverse edge, surface it for `domain-updater`.
|
|
59
|
+
4. **ARCHIVE FILES ARE OPT-IN** — read `<slug>.archive.md` only when `_index.json` shows `status: archived` or when you need pre-cap history.
|
|
60
|
+
5. **DO NOT EDIT DOMAIN FILES DIRECTLY** — only `documenter` and `domain-updater` write here. If something is wrong, fix the agent or report drift.
|
|
61
|
+
6. **TRUST `last_commit`** — if `_index.json#last_commit` ≠ HEAD, the documenter forgot to run; pause and fix instead of working with stale knowledge.
|
|
62
|
+
|
|
63
|
+
## See Also
|
|
64
|
+
|
|
65
|
+
- `documenter` v2.0.0 — writes to this layout (after every commit)
|
|
66
|
+
- `domain-updater` v2.0.0 — writes session wisdom (Problems & Solutions, Attention Points)
|
|
67
|
+
- `docs-tracker` v2.0.0 — file → domain mapping rules
|
|
68
|
+
- `claude-md-compactor` v2.0.0 — keeps `CLAUDE.md` ≤ 20 KB; this layer keeps each domain ≤ 8 KB
|
|
@@ -1,23 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
domain: <slug>
|
|
3
|
+
tags: [tag1, tag2]
|
|
4
|
+
owner: <team or "shared">
|
|
5
|
+
last_commit: <short-sha>
|
|
6
|
+
last_date: YYYY-MM-DD
|
|
7
|
+
files_count: 0
|
|
8
|
+
connections: []
|
|
9
|
+
status: active
|
|
10
|
+
---
|
|
2
11
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
# <Title> Domain
|
|
13
|
+
|
|
14
|
+
> **TL;DR** (≤ 3 lines). What lives here, where the boundary is, who calls it.
|
|
15
|
+
> Example: "User session lifecycle. Owns Sanctum cookie, login, password reset.
|
|
16
|
+
> Does NOT own user profile data (see `users` domain)."
|
|
7
17
|
|
|
8
18
|
## Files
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
|
|
20
|
+
| Path | Role |
|
|
21
|
+
|---|---|
|
|
11
22
|
|
|
12
23
|
## Connections
|
|
13
|
-
| Domain | How They Connect |
|
|
14
|
-
|--------|-----------------|
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
| Direction | Domain | What flows |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
|
|
28
|
+
## Recent Commits (capped at 20 — oldest auto-archived)
|
|
29
|
+
|
|
30
|
+
| Hash | Date | Subject |
|
|
31
|
+
|---|---|---|
|
|
19
32
|
|
|
20
33
|
## Attention Points
|
|
21
|
-
-
|
|
22
34
|
|
|
23
|
-
|
|
35
|
+
(≤ 10 entries; oldest beyond 10 → `<slug>.archive.md`)
|
|
36
|
+
|
|
37
|
+
## Problems & Solutions (append-only)
|
|
38
|
+
|
|
39
|
+
(≤ 5 entries; oldest beyond 5 → `<slug>.archive.md`)
|
|
40
|
+
|
|
41
|
+
## See Also
|
|
42
|
+
|
|
43
|
+
- Skill: `<skill-name §section>`
|
|
44
|
+
- Domain: `<related-slug>`
|
|
@@ -1,56 +1,104 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: docs-tracker
|
|
3
|
-
version:
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "File → domain mapping rules and changelog templates consumed by `documenter` v2.0.0. Detects modified files via `git diff-tree`, classifies them via `.claude/config/domain-mapping.json`, and emits the actions documenter must apply (Edit known anchors, never Write over existing files; bidirectional connections; cap commit log at 20)."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Docs Tracker —
|
|
7
|
+
# Docs Tracker — File → Domain Mapping Rules (v2.0.0)
|
|
7
8
|
|
|
8
|
-
**ALWAYS invoke AFTER
|
|
9
|
+
**ALWAYS invoke AFTER `commit-manager` succeeds (so the commit hash is real).**
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
This skill is the **rule set** consumed by `documenter` v2.0.0. It does not write files itself — it tells documenter what to do with each changed file.
|
|
11
12
|
|
|
13
|
+
## Detection (one git call, not many)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Files in the LAST commit (after commit-manager pushed)
|
|
17
|
+
git diff-tree --no-commit-id --name-status -r HEAD
|
|
12
18
|
```
|
|
13
|
-
1. DETECT CHANGES → git diff --name-status
|
|
14
|
-
↓
|
|
15
|
-
2. CLASSIFY → A=Added, M=Modified, D=Deleted
|
|
16
|
-
↓
|
|
17
|
-
3. CHECK EXISTING DOCS → codebase-knowledge/domains/
|
|
18
|
-
↓
|
|
19
|
-
4. CREATE/UPDATE/REMOVE as needed
|
|
20
|
-
↓
|
|
21
|
-
5. UPDATE CLAUDE.md "Last Change" section
|
|
22
|
-
```
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
Status codes: `A` = added, `M` = modified, `D` = deleted, `R` = renamed, `C` = copied. Treat `R` and `C` as `M` for mapping purposes plus a "renamed from" note in the destination domain.
|
|
21
|
+
|
|
22
|
+
## File → Domain mapping
|
|
23
|
+
|
|
24
|
+
Source of truth: `.claude/config/domain-mapping.json` (shipped with this CLI; project may override). A path may map to ≥1 domain. Unmatched paths → `general`.
|
|
25
|
+
|
|
26
|
+
Skip the entire pass if every changed path matches one of:
|
|
25
27
|
|
|
26
|
-
|
|
|
28
|
+
| Skip pattern | Reason |
|
|
27
29
|
|---|---|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
30
|
+
| `.claude/**` | meta — does not belong to any product domain |
|
|
31
|
+
| `docs/**` | docs commit — no code drift |
|
|
32
|
+
| `.github/**` | CI — handled by `infrastructure` domain only if pattern is added |
|
|
33
|
+
| `CHANGELOG*`, `*.md` (root only) | release docs |
|
|
34
|
+
| `package.json`, `composer.json`, `pyproject.toml` (deps only — not scripts) | bumps tracked elsewhere |
|
|
35
|
+
|
|
36
|
+
## Action matrix (applied by `documenter`)
|
|
37
|
+
|
|
38
|
+
| Git status | Domain file state | Action |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `A` | exists | `Edit`: append row to `## Files`, prepend row to `## Recent Commits`, increment `files_count` in frontmatter |
|
|
41
|
+
| `A` | missing | `Write`: create from `TEMPLATE.md`, fill TL;DR, add the file row, add the commit row |
|
|
42
|
+
| `M` | exists | `Edit`: prepend row to `## Recent Commits`; if file's role description changed, update its row in `## Files` |
|
|
43
|
+
| `M` | missing | unusual — investigate; usually means mapping rule was added but file existed before. Treat as `A` |
|
|
44
|
+
| `D` | exists | `Edit`: strike-through (`~~path~~`) row in `## Files`, decrement `files_count`. Prune at the next pass |
|
|
45
|
+
| `R src→dst` | exists | `Edit`: replace `src` row with `dst` row, add note `(renamed from src in <short-sha>)` to Attention Points |
|
|
46
|
+
|
|
47
|
+
## Bidirectional connections (mandatory)
|
|
48
|
+
|
|
49
|
+
When a session adds `auth → api` to `auth.md`, **also** add `api ← auth` to `api.md`. The two edits must succeed atomically — if the second fails, roll back the first. The `security-auditor` flags dangling links as a MEDIUM finding.
|
|
50
|
+
|
|
51
|
+
## Cap and archive (size guard)
|
|
33
52
|
|
|
34
|
-
|
|
53
|
+
After any edit, check the live file:
|
|
35
54
|
|
|
36
55
|
```bash
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
[ "$(wc -c < domains/<slug>.md)" -gt 8192 ] && trigger_archive
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
When triggered, move the **oldest 5 rows** of `## Recent Commits` (and oldest 2 Problems & Solutions, oldest 3 Attention Points) into `<slug>.archive.md`. Live file must stay ≤ 8 KB.
|
|
39
60
|
|
|
40
|
-
|
|
41
|
-
git diff --name-only --cached
|
|
61
|
+
## Index regeneration (after every pass)
|
|
42
62
|
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
```bash
|
|
64
|
+
# Regenerate _index.json from frontmatter of every domain file
|
|
65
|
+
for f in .claude/skills/codebase-knowledge/domains/*.md; do
|
|
66
|
+
# parse YAML frontmatter, compute summary_sha = sha256(TL;DR block), emit one record
|
|
67
|
+
done | jq -s '{schema_version:1, generated_at:(now|todate), domain_count:length, domains:.}' \
|
|
68
|
+
> .claude/skills/codebase-knowledge/_index.json
|
|
45
69
|
|
|
46
|
-
#
|
|
47
|
-
|
|
70
|
+
# Then derive _INDEX.md from _index.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`_index.json` is the source of truth — `_INDEX.md` is human-readable derivative.
|
|
74
|
+
|
|
75
|
+
## Pre-commit hook (CI integration)
|
|
76
|
+
|
|
77
|
+
A repository can add this check to fail builds when documenter forgot to run:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
HEAD_SHA=$(git rev-parse --short HEAD)
|
|
81
|
+
LAST_INDEXED=$(jq -r '.domains | map(.last_commit) | unique[]' \
|
|
82
|
+
.claude/skills/codebase-knowledge/_index.json)
|
|
83
|
+
echo "$LAST_INDEXED" | grep -qx "$HEAD_SHA" || {
|
|
84
|
+
echo "ERROR: _index.json is stale. Run documenter before pushing."
|
|
85
|
+
exit 1
|
|
86
|
+
}
|
|
48
87
|
```
|
|
49
88
|
|
|
50
89
|
## Rules
|
|
51
90
|
|
|
52
|
-
1. **
|
|
53
|
-
2. **DETECT VIA GIT** —
|
|
54
|
-
3. **
|
|
55
|
-
4. **BIDIRECTIONAL** —
|
|
56
|
-
5. **
|
|
91
|
+
1. **AFTER `commit-manager`** — never before; the hash must be real.
|
|
92
|
+
2. **DETECT VIA GIT** — `git diff-tree -r HEAD`, never guess from session memory.
|
|
93
|
+
3. **EDIT KNOWN ANCHORS** — `documenter` uses `Edit` / `StrReplace` on existing domain files; never `Write` over them.
|
|
94
|
+
4. **BIDIRECTIONAL** — both ends of every connection updated atomically.
|
|
95
|
+
5. **CAP AT 8 KB / 20 commits / 10 attention / 5 P&S** — archive overflow into `<slug>.archive.md`.
|
|
96
|
+
6. **REGENERATE `_index.json` EVERY PASS** — derived; never hand-edited.
|
|
97
|
+
7. **SKIP META PATHS** — `.claude/**`, `docs/**`, `.github/**` do not get domain entries.
|
|
98
|
+
|
|
99
|
+
## See Also
|
|
100
|
+
|
|
101
|
+
- `documenter` v2.0.0 — applies the actions defined here
|
|
102
|
+
- `codebase-knowledge` v2.0.0 — reads what documenter wrote
|
|
103
|
+
- `domain-updater` v2.0.0 — appends session wisdom AFTER documenter
|
|
104
|
+
- `.claude/config/domain-mapping.json` — pattern → domain rules
|
|
@@ -1,62 +1,139 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: research-cache
|
|
3
|
-
version:
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "Caches web research findings under `.claude/skills/research-cache/cache/` to avoid redundant searches. Each entry has YAML frontmatter (`expires_on`, `sources`, `tier`, `engines`) so a session can grep-filter fresh entries without reading the body. Consumed by `research-web` v2.0.0 BEFORE any MCP / WebSearch call."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Research Cache — Best
|
|
7
|
+
# Research Cache — Best-Practices Storage (v2.0.0)
|
|
7
8
|
|
|
8
|
-
**ALWAYS invoke BEFORE any web research.**
|
|
9
|
+
**ALWAYS invoke BEFORE any web research.** This skill is the **read AND write** side of `research-web` v2.0.0.
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
Caches research findings to avoid redundant searches and maintain institutional knowledge.
|
|
13
|
-
|
|
14
|
-
## Structure
|
|
11
|
+
## Layout
|
|
15
12
|
|
|
16
13
|
```
|
|
17
14
|
.claude/skills/research-cache/
|
|
18
15
|
├── SKILL.md
|
|
19
16
|
└── cache/
|
|
20
|
-
├──
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
├── _index.json # auto-derived, optional (one record per cache entry)
|
|
18
|
+
└── <topic-slug>.md # one file per topic. ≤ 8 KB. Pruned at expires_on.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Cache entry frontmatter (token-efficient lookup)
|
|
22
|
+
|
|
23
|
+
Every cache entry MUST start with this frontmatter so a `grep` over `cache/*.md` filters fresh entries without parsing bodies:
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
---
|
|
27
|
+
topic: <kebab-case>
|
|
28
|
+
stack: php | nodejs | python | universal | frontend
|
|
29
|
+
researched_on: YYYY-MM-DD
|
|
30
|
+
expires_on: YYYY-MM-DD # researched_on + 30 days (60 for stable specs, 14 for moving libraries)
|
|
31
|
+
tier: 1 | 2 # 1 = MCP web-scraper used; 2 = built-in WebSearch fallback
|
|
32
|
+
engines: [brave, vertex, grok] # which engines contributed (Tier 1 only)
|
|
33
|
+
sources_count: <int>
|
|
34
|
+
confidence: high | medium | low # high = 3+ official-doc sources agree; low = single blog post
|
|
35
|
+
---
|
|
23
36
|
```
|
|
24
37
|
|
|
25
|
-
##
|
|
38
|
+
## Read protocol (lookup BEFORE searching)
|
|
26
39
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
4. If not found → Research and CREATE cache entry
|
|
40
|
+
```bash
|
|
41
|
+
TOPIC="<kebab-case>"
|
|
42
|
+
TODAY=$(date +%F)
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
# 1. Direct hit?
|
|
45
|
+
F=".claude/skills/research-cache/cache/${TOPIC}.md"
|
|
46
|
+
if [ -f "$F" ]; then
|
|
47
|
+
EXPIRES=$(awk -F': ' '/^expires_on:/{print $2; exit}' "$F")
|
|
48
|
+
[ "$EXPIRES" \> "$TODAY" ] && echo "FRESH cache hit: $F" && exit 0
|
|
49
|
+
echo "STALE: $F (expired $EXPIRES); will refresh"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# 2. Fuzzy hit? (alias / synonym)
|
|
53
|
+
grep -l "topic:.*${TOPIC%%-*}" .claude/skills/research-cache/cache/*.md 2>/dev/null
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If FRESH → use the cache, do NOT re-search.
|
|
57
|
+
If STALE or MISSING → research, then write a new entry (overwrite or create).
|
|
58
|
+
|
|
59
|
+
## Write protocol (after research)
|
|
60
|
+
|
|
61
|
+
Always overwrite — never append. Stale data is worse than missing data.
|
|
62
|
+
|
|
63
|
+
### Body template
|
|
33
64
|
|
|
34
65
|
```markdown
|
|
35
|
-
|
|
66
|
+
---
|
|
67
|
+
topic: <kebab-case>
|
|
68
|
+
stack: <one-of>
|
|
69
|
+
researched_on: 2026-05-13
|
|
70
|
+
expires_on: 2026-06-12
|
|
71
|
+
tier: 1
|
|
72
|
+
engines: [brave, vertex, grok]
|
|
73
|
+
sources_count: 5
|
|
74
|
+
confidence: high
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
# Research: <Topic Title>
|
|
36
78
|
|
|
37
|
-
**
|
|
38
|
-
**Stack:** PHP|Node.js|Universal
|
|
39
|
-
**Sources:** [list]
|
|
40
|
-
**Expires:** YYYY-MM-DD (30 days from research)
|
|
79
|
+
> **TL;DR** (≤ 3 lines). The actionable answer in 30 seconds.
|
|
41
80
|
|
|
42
|
-
##
|
|
43
|
-
|
|
81
|
+
## Findings (cited)
|
|
82
|
+
|
|
83
|
+
| # | Finding | Source | Date | Tier |
|
|
84
|
+
|---|---|---|---|---|
|
|
85
|
+
| 1 | <one-line> | https://docs.example.com/foo | 2026-04-12 | official |
|
|
86
|
+
| 2 | <one-line> | https://eng-blog.example.com/bar | 2026-03-30 | engineering |
|
|
44
87
|
|
|
45
88
|
## Recommendations
|
|
46
|
-
- Actionable recommendation
|
|
47
89
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
90
|
+
- <actionable rule, ready to drop into a skill or CLAUDE.md>
|
|
91
|
+
- <do this, not that>
|
|
92
|
+
|
|
93
|
+
## Anti-patterns
|
|
94
|
+
|
|
95
|
+
- <something to avoid + why>
|
|
96
|
+
|
|
97
|
+
## Code reference (optional)
|
|
98
|
+
|
|
99
|
+
- File / line / commit pointing at where this rule should be applied — NOT inline code dumps.
|
|
100
|
+
|
|
101
|
+
## Open questions
|
|
52
102
|
|
|
53
|
-
|
|
54
|
-
- [URL] — [Description]
|
|
103
|
+
- <thing the research did NOT answer; flag for next round>
|
|
55
104
|
```
|
|
56
105
|
|
|
106
|
+
## Expiry policy (cost vs freshness)
|
|
107
|
+
|
|
108
|
+
| Topic kind | TTL | Example |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| Specification (W3C, RFC, OpenAPI) | 60 days | WCAG 2.2 conformance |
|
|
111
|
+
| Stable framework (Laravel, Django, Express) | 30 days | Laravel 12 sessions |
|
|
112
|
+
| Fast-moving library (any minor < 1.0, anything pre-release) | 14 days | shadcn registries, AI SDKs |
|
|
113
|
+
| Security advisory | 7 days | CVE feeds, OWASP draft |
|
|
114
|
+
|
|
115
|
+
After `expires_on`, the entry is read-only history — `research-web` will refresh it on the next lookup.
|
|
116
|
+
|
|
117
|
+
## Source ranking (recorded in each finding row)
|
|
118
|
+
|
|
119
|
+
1. **official** — vendor docs, RFCs, W3C, MDN
|
|
120
|
+
2. **engineering** — engineering blogs of the project (vercel.com/blog, fastify.io/blog)
|
|
121
|
+
3. **community** — high-signal: Stack Overflow with 50+ votes, GitHub issues with maintainer response
|
|
122
|
+
4. **opinion** — random blog post — accepted only if it confirms an official-doc claim, never as primary
|
|
123
|
+
|
|
57
124
|
## Rules
|
|
58
125
|
|
|
59
|
-
1. **CHECK CACHE FIRST** —
|
|
60
|
-
2. **
|
|
61
|
-
3. **
|
|
62
|
-
4. **
|
|
126
|
+
1. **CHECK CACHE FIRST** — frontmatter `expires_on` lookup is one `awk`. Cheaper than any web call.
|
|
127
|
+
2. **OVERWRITE, NEVER APPEND** — stale information is worse than missing.
|
|
128
|
+
3. **CITE EVERY FINDING** — URL + date + tier. No bare claims.
|
|
129
|
+
4. **TTL BY TOPIC KIND** — see table above. A spec lasts longer than a pre-release library.
|
|
130
|
+
5. **CONFIDENCE EXPLICIT** — `high` requires ≥ 3 official-doc sources agreeing; `low` is single source.
|
|
131
|
+
6. **NO INLINE CODE DUMPS** — link to file/line; the model can `Read` when it needs the bytes.
|
|
132
|
+
7. **NO PII / SECRETS / CUSTOMER DATA** — never quote env values, tokens, internal hostnames.
|
|
133
|
+
8. **PROMOTE WHAT'S UNIVERSAL** — if a rule applies project-wide, surface it for inclusion in `CLAUDE.md` (do not auto-edit).
|
|
134
|
+
|
|
135
|
+
## See Also
|
|
136
|
+
|
|
137
|
+
- `research-web` v2.0.0 — MCP-first researcher; reads/writes this cache
|
|
138
|
+
- `claude-md-compactor` v2.0.0 — receives promoted rules; enforces 20 KB CLAUDE.md budget
|
|
139
|
+
- `mcp-web-scraper` skill — the MCP server providing Tier 1 search/scrape capability
|