leancraft 0.1.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/.claude/skills/leancraft/SKILL.md +90 -0
- package/.cursor/rules/leancraft.mdc +70 -0
- package/.leancraft/README.md +26 -0
- package/.leancraft/SKILL.md +90 -0
- package/.leancraft/agent/context.md +37 -0
- package/.leancraft/agent/proposals/README.md +24 -0
- package/.leancraft/agent/status.md +31 -0
- package/.leancraft/config.json +357 -0
- package/.leancraft/human/definition/features/042-example-feature.md +32 -0
- package/.leancraft/human/definition/guardrails.md +37 -0
- package/.leancraft/human/definition/intent.md +31 -0
- package/.leancraft/human/definition/system.md +48 -0
- package/.leancraft/human/discovery/00-index.md +40 -0
- package/.leancraft/human/discovery/00-overview.md +31 -0
- package/.leancraft/human/discovery/01-vision.md +29 -0
- package/.leancraft/human/discovery/02-research.md +104 -0
- package/.leancraft/human/discovery/03-competitive.md +28 -0
- package/.leancraft/human/discovery/04-personas.md +24 -0
- package/.leancraft/human/discovery/05-jtbd.md +27 -0
- package/.leancraft/human/discovery/06-prd.md +101 -0
- package/.leancraft/human/sprint/map.md +22 -0
- package/.leancraft/joint/decisions.log.md +21 -0
- package/.leancraft/joint/ledger.jsonl +3 -0
- package/.leancraft/joint/test-report.md +20 -0
- package/.leancraft/templates/definition/feature.md +32 -0
- package/.leancraft/templates/definition/guardrails.md +39 -0
- package/.leancraft/templates/definition/intent.md +33 -0
- package/.leancraft/templates/definition/system.md +47 -0
- package/.leancraft/templates/discovery/00-index.md +40 -0
- package/.leancraft/templates/discovery/00-overview.md +31 -0
- package/.leancraft/templates/discovery/01-vision.md +28 -0
- package/.leancraft/templates/discovery/02-research.md +104 -0
- package/.leancraft/templates/discovery/03-competitive.md +27 -0
- package/.leancraft/templates/discovery/04-personas.md +26 -0
- package/.leancraft/templates/discovery/05-jtbd.md +27 -0
- package/.leancraft/templates/discovery/06-prd.md +102 -0
- package/.leancraft/templates/sprint/map.md +23 -0
- package/.mcp.json +10 -0
- package/AGENTS.md +70 -0
- package/CLAUDE.md +5 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/bin/leancraft.js +128 -0
- package/package.json +55 -0
- package/scripts/install-hooks.mjs +27 -0
- package/scripts/leancraft-lock.mjs +30 -0
- package/scripts/leancraft-sync.mjs +105 -0
- package/scripts/leancraft-validate.mjs +159 -0
- package/scripts/mcp-server.mjs +122 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Leancraft — Doc-First Verified Agency
|
|
2
|
+
|
|
3
|
+
You are in a Leancraft repo. This skill is law. Follow `.leancraft/config.json`, not vibes.
|
|
4
|
+
|
|
5
|
+
## 1. MANDATORY READ SEQUENCE (every run)
|
|
6
|
+
|
|
7
|
+
1. `.leancraft/config.json` — `locked`, `docRegistry`, `budget`, `researchMap`. This is the contract.
|
|
8
|
+
2. `.leancraft/human/discovery/00-index.md` → `00-overview.md` → target doc
|
|
9
|
+
3. `.leancraft/human/definition/intent.md` — invariants (I1:) + oracles (O1:) — the executable spec
|
|
10
|
+
4. `.leancraft/human/definition/guardrails.md` — security/perf/a11y/i18n checks
|
|
11
|
+
5. `.leancraft/agent/context.md` — 500-line compressed memory (anti context-rot)
|
|
12
|
+
6. Template in `.leancraft/templates/**` for the doc you will write (exact required sections + min counts)
|
|
13
|
+
|
|
14
|
+
If any `human/**` is DRAFT or missing, **do not code**. Draft docs first.
|
|
15
|
+
|
|
16
|
+
## 2. OWNERSHIP — HARD RULES
|
|
17
|
+
|
|
18
|
+
- `human/**` — READ-ONLY when `locked:true`. NEVER call `write`/`edit` on it. Hook will reject. To change it, write `agent/proposals/NNN-<target>.md` with `Source, Why, Diff` and ask human `[🔓 Unlock / ❌ Don't]`.
|
|
19
|
+
- `agent/**` — You own. Keep `agent/context.md` (max 500 lines) + `agent/status.md` updated. Call `leancraft:sync` logic.
|
|
20
|
+
- `joint/**` — Append only. Cite `source doc + line`.
|
|
21
|
+
|
|
22
|
+
## 3. REGISTRY IS TIGHT — YOU MAY ONLY CREATE DOCS IN `config.json.docRegistry`
|
|
23
|
+
|
|
24
|
+
- `discovery`: `00-index`, `00-overview`, `01-vision`, `02-research`, `03-competitive`, `04-personas`, `05-jtbd`, `06-prd` — all required.
|
|
25
|
+
- `definition`: `intent`, `system`, `guardrails` — all required. `features/*.md` — one per flow from `06-prd.md`.
|
|
26
|
+
- `sprint`: `map`, `sketches`, `test-report` — optional, for Design Sprint.
|
|
27
|
+
- `conditional`: `07-data`, `08-agents`, `09-skills`, `10-ux`, `11-design-system` — only if product needs them (see config). Do not create `12-future.md`.
|
|
28
|
+
- Each doc has `required sections` + `min counts` (e.g., 02 needs 12 pains P1-P12, 12 URLs; 03 needs 9 competitors + $; 06 needs 3 flows + 10 FRs). `validate` blocks Lock if you miss one.
|
|
29
|
+
|
|
30
|
+
## 4. RESEARCH MAP — WHAT TO SEARCH PER DOC (type, not tool name)
|
|
31
|
+
|
|
32
|
+
Your `web_search` may be `tavily_search`, `exa_search`, `brave_search`, or `WebSearch` — any counts. Your `web_fetch` may be `firecrawl`, `exa_fetch`, `WebFetch`, or `fetch` — any counts. Match by **type**, not name.
|
|
33
|
+
|
|
34
|
+
| Doc | What to do | Type Needed | Examples | What to compile | Validation |
|
|
35
|
+
|---|---|---|---|---|---|
|
|
36
|
+
| `02-research.md` | Search `{idea} pain, {idea} reddit, {idea} alternative, {idea} complaint` on Reddit/X/HN/G2 | `web_search` + `web_fetch` | Tavily/Exa/Brave/WebSearch + Firecrawl/Exa_Fetch/WebFetch | 12 pains P1-P12, each `Quote + URL + Date + Platform` (fetchable) | 12 headings P1-P12 + 12 URLs |
|
|
37
|
+
| `03-competitive.md` | Search `{idea} vs, {idea} alternative, {idea} pricing` | `web_search` | Tavily/Exa/Brave/WebSearch | 9+ competitors with URL + pricing table with `$`, 5+ wedges | 9 URLs + `$` |
|
|
38
|
+
| `04-personas.md` | **DERIVE FROM `02-research.md` P# ONLY — no new search** | — | — | 5 personas, each pain links to P#, + affinity map | 5 personas + P# links |
|
|
39
|
+
| `05-jtbd.md` | **DERIVE FROM `02,03,04`** | — | — | JTBD per persona + empathy maps + pain matrix | 5 empathy maps + matrix |
|
|
40
|
+
| `06-prd.md` | **DERIVE FROM `02,04,05`** | — | ≥3 flows, ≥10 FRs (FR-01…), NFRs, risks | 3 flows + 10 FRs |
|
|
41
|
+
| `intent.md` | **DISTILL FROM `06-prd.md`** | — | — | ≥3 invariants (I1:) with Check command + ≥2 oracles (O1:) | 3 I + 2 O |
|
|
42
|
+
| `system.md` | **DISTILL FROM `06,02`** | repo scan | — | Pinned stack + architecture + decisions | pinned versions |
|
|
43
|
+
| `guardrails.md` | **DISTILL FROM `system.md`** | — | — | Security/perf/a11y/i18n with Check commands | 4 sections |
|
|
44
|
+
| `features/*.md` | **1 per flow from `06-prd.md`** — `042-kebab-case.md` | — | — | Invariants + oracles + acceptance + Source Trace: FR-# + Persona | trace present |
|
|
45
|
+
|
|
46
|
+
**If you have no tool of that type:** STOP. Do NOT invent. Write to `agent/status.md`: `BLOCKED: No web_search available — human must provide 02-research.md or connect a search connector (Tavily/Exa/Brave)` and append to `joint/decisions.log.md`. Ask human directly in chat. Also log: `Inform user in chat + docs that web search is unavailable and human must paste research or enable a connector.`
|
|
47
|
+
|
|
48
|
+
**Anti-hallucination:** If your `web_search` returns 0 results, say so in `status.md`, do not invent. For `04,05,06,intent` you MUST cite `P#`/`FR-#` — inventing a new pain is a failure.
|
|
49
|
+
|
|
50
|
+
## 5. ONE DOC PER FEATURE — HARD RULE
|
|
51
|
+
|
|
52
|
+
- `human/definition/features/` — `NNN-kebab-case.md` (e.g., `042-pdf-export.md`), 1 per flow from `06-prd.md`.
|
|
53
|
+
- Each feature doc has `intent, invariants (with Check), oracles, acceptance, Source Trace: FR-# + Persona`.
|
|
54
|
+
- Do not put 2 features in one doc. Do not create a feature doc before `06-prd.md` has that flow.
|
|
55
|
+
- `validate` will warn if feature has no trace. Human checks trace is real.
|
|
56
|
+
|
|
57
|
+
## 6. ANTI-HALLUCINATION — NEVER FABRICATE
|
|
58
|
+
|
|
59
|
+
- **URLs/Quotes:** Every quote in `02-research.md` must be verbatim `Quote + URL + Date + Platform` that is fetchable via `firecrawl`. No hallucinated URLs. If you cannot fetch, mark `Source: not found`.
|
|
60
|
+
- **Pricing:** Every competitor in `03-competitive.md` must have real URL + pricing with `$`/`€`/`£` fetched from their pricing page. No invented `$29`.
|
|
61
|
+
- **Derivation:** `04,05,06,intent` must cite `P#`/`FR-#`. Do not invent P13 or FR-99.
|
|
62
|
+
- **Stack:** Pinned versions in `system.md` must be from `package.json`/`wrangler.jsonc`, not guessed.
|
|
63
|
+
- **Never claim** `validate` PASS, test PASS, or `Lock` while validator is red. Never fabricate test results, post-mortems, or consultation logs.
|
|
64
|
+
|
|
65
|
+
## 7. SYCOPHANCY GUARD
|
|
66
|
+
|
|
67
|
+
If human asks for bad idea (global, string-concat SQL, innerHTML, no scope), check `guardrails.md` + `intent.md` invariants first. Push back: `This violates [I3 / guardrails CWE-89]. Propose alternative: [parameterized query].` Do not agree.
|
|
68
|
+
|
|
69
|
+
## 8. BUDGET & SANDBOX
|
|
70
|
+
|
|
71
|
+
- Max $5, 25 calls, 30 min. Network `deny-all` except `allowlist` in `.leancraft/config.json` (default: `registry.npmjs.org`, `registry.yarnpkg.com`, `pypi.org` — covers `npm`/`pnpm`/`bun`/`npx`, they all use the same registry). Never read `.env`, `DATABASE_URL`, `GITHUB_TOKEN` is read-only.
|
|
72
|
+
- **Non-tech: you never edit allowlist manually.** Agent detects needed hosts from `system.md` / `package.json` / network error, then asks you in chat: `[Allow api.stripe.com? / Deny]` + writes a proposal to `agent/proposals/`. You click Allow → agent updates `config.json` for you. No manual JSON edit.
|
|
73
|
+
|
|
74
|
+
## 9. DEFINITION OF DONE — BEFORE CLAIMING DONE
|
|
75
|
+
|
|
76
|
+
- [ ] `npm run leancraft:validate` → PASS (no TODO, all sections, min counts, URLs)
|
|
77
|
+
- [ ] No fabricated URLs/quotes/test results
|
|
78
|
+
- [ ] `npm run leancraft:sync` → `agent/context.md` + `status.md` updated, `ledger.jsonl` appended
|
|
79
|
+
- [ ] If `locked`, you did NOT edit `human/**`
|
|
80
|
+
- [ ] Teach-back ready: you can explain invariant + why without reading code
|
|
81
|
+
|
|
82
|
+
Never claim done while `validate` is red. Never hallucinate.
|
|
83
|
+
|
|
84
|
+
## 10. BOOTSTRAP (first idea)
|
|
85
|
+
|
|
86
|
+
1. Read `config.json.docRegistry` → templates in `.leancraft/templates/**`
|
|
87
|
+
2. For each required doc, follow researchMap + template, then `validate`
|
|
88
|
+
3. Fix until PASS, then ask human `[🔒 Lock / ✏️ Edit]`
|
|
89
|
+
|
|
90
|
+
This skill is the lock. Follow config, not vibes.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# AGENTS.md — Leancraft Doc-First Repo
|
|
2
|
+
|
|
3
|
+
> This file is auto-read by Claude Code, Opencode, Cursor. Do not skip.
|
|
4
|
+
|
|
5
|
+
You are in a **Leancraft** repo. This is a doc-first, human-owned system. Your job is to draft, not decide. Human locks, you propose.
|
|
6
|
+
|
|
7
|
+
## MANDATORY READ SEQUENCE (every run, no exceptions)
|
|
8
|
+
|
|
9
|
+
1. `.leancraft/config.json` — the registry. `locked`, `docRegistry`, `budget`, `researchMap`. This is law.
|
|
10
|
+
2. `.leancraft/human/discovery/00-index.md` → `00-overview.md` → target doc
|
|
11
|
+
3. `.leancraft/human/definition/intent.md` + `guardrails.md` — invariants + security rules you MUST obey
|
|
12
|
+
4. `.leancraft/agent/context.md` — 500-line compressed memory (anti context-rot)
|
|
13
|
+
5. Template in `.leancraft/templates/**` for the doc you are about to write
|
|
14
|
+
|
|
15
|
+
If any `human/**` is `DRAFT` or missing, **do not code**. Draft docs first, run `validate`, then ask to Lock.
|
|
16
|
+
|
|
17
|
+
## OWNERSHIP — HARD RULES
|
|
18
|
+
|
|
19
|
+
- `human/**` — READ-ONLY when `locked:true`. NEVER call `write`/`edit` on it. To change it, write `agent/proposals/NNN-<target>.md` with `Source, Why, Diff` and ask `[🔓 Unlock / ❌ Don't]`. Hook will reject direct edits.
|
|
20
|
+
- `agent/**` — You own. Keep `context.md` + `status.md` updated. Max 500 lines for `context.md`.
|
|
21
|
+
- `joint/**` — Append only, cite `source doc + line`.
|
|
22
|
+
|
|
23
|
+
## REGISTRY IS TIGHT — NO HALLUCINATION
|
|
24
|
+
|
|
25
|
+
- You may ONLY create docs listed in `config.json.docRegistry`. Do not invent `13-future.md`.
|
|
26
|
+
- Each doc has `required sections` + `min counts`. `validate` will block Lock if you miss one.
|
|
27
|
+
- **Never hallucinate URLs, quotes, or pricing.** Every quote in `02-research.md` needs verbatim `Quote + URL + Date + Platform` that is fetchable. Every competitor in `03-competitive.md` needs real URL + pricing with `$`. `validate` checks counts; human checks truth.
|
|
28
|
+
|
|
29
|
+
## RESEARCH MAP — WHAT TO SEARCH PER DOC (type, not tool name)
|
|
30
|
+
|
|
31
|
+
Your `web_search` may be `tavily_search`, `exa_search`, `brave_search`, or `WebSearch` — any counts. Your `web_fetch` may be `firecrawl`, `exa_fetch`, `WebFetch`, or `fetch` — any counts. Match by **type**, not name.
|
|
32
|
+
|
|
33
|
+
| Doc | Search / Derive | Type Needed | Examples | What to compile |
|
|
34
|
+
|---|---|---|---|---|
|
|
35
|
+
| `02-research.md` | Search `{idea} pain, {idea} reddit, {idea} alternative, {idea} complaint` on Reddit/X/HN/G2 | `web_search` + `web_fetch` | Tavily/Exa/Brave/WebSearch + Firecrawl/Exa_Fetch/WebFetch | 12 pains P1-P12, each with Quote + URL + Date |
|
|
36
|
+
| `03-competitive.md` | Search `{idea} vs, {idea} alternative, {idea} pricing` | `web_search` | Tavily/Exa/Brave/WebSearch | 9+ competitors with URL + pricing table ($), 5+ wedges |
|
|
37
|
+
| `04-personas.md` | **DERIVE FROM `02-research.md` P# ONLY** — no new search | — | — | 5 personas, each pain links to P#, + affinity map |
|
|
38
|
+
| `05-jtbd.md` | **DERIVE FROM `02,03,04`** | — | — | JTBD per persona + empathy maps + pain matrix |
|
|
39
|
+
| `06-prd.md` | **DERIVE FROM `02,04,05`** | — | — | ≥3 flows, ≥10 FRs (FR-01...), NFRs, risks |
|
|
40
|
+
| `intent.md` | **DISTILL FROM `06-prd.md`** | — | — | ≥3 invariants (I1:) with Check command + ≥2 oracles |
|
|
41
|
+
| `system.md` | **DISTILL FROM `06,02`** | repo scan | — | Pinned stack + architecture + decisions |
|
|
42
|
+
| `guardrails.md` | **DISTILL FROM `system.md`** | — | — | Security/perf/a11y/i18n with Check commands |
|
|
43
|
+
| `features/*.md` | **1 per flow from `06-prd.md`** — `042-kebab-case.md` | — | — | Invariants + oracles + acceptance + Source Trace |
|
|
44
|
+
|
|
45
|
+
**If you have no tool of that type:** STOP. Do NOT invent. Write to `agent/status.md`: `BLOCKED: No web_search available — human must provide 02-research.md or connect a search connector (Tavily/Exa/Brave)` and append to `joint/decisions.log.md`. Ask human directly in chat. Also log: `Inform user in chat + docs that web search is unavailable and human must paste research or enable a connector.`
|
|
46
|
+
|
|
47
|
+
**Anti-hallucination:** If your `web_search` returns 0 results, say so in `status.md`, do not invent. For `04,05,06,intent` you MUST cite `P#`/`FR-#` — inventing a new pain is a failure.
|
|
48
|
+
|
|
49
|
+
## ONE DOC PER FEATURE — HARD RULE
|
|
50
|
+
|
|
51
|
+
- `human/definition/features/` — `NNN-kebab-case.md` (e.g., `042-pdf-export.md`), 1 per flow from `06-prd.md`.
|
|
52
|
+
- Each feature doc has `intent, invariants (with Check), oracles, acceptance, Source Trace: FR-# + Persona`.
|
|
53
|
+
- Do not put 2 features in one doc. Do not create a feature doc before `06-prd.md` has that flow. `validate` will warn if feature has no trace.
|
|
54
|
+
|
|
55
|
+
## DEFINITION OF DONE — BEFORE CLAIMING DONE
|
|
56
|
+
|
|
57
|
+
- [ ] `npm run leancraft:validate` → PASS (no TODO, all sections, min counts, URLs)
|
|
58
|
+
- [ ] No fabricated URLs, quotes, or test results
|
|
59
|
+
- [ ] `npm run leancraft:sync` → `agent/context.md` + `status.md` updated, `ledger.jsonl` appended
|
|
60
|
+
- [ ] If `locked`, you did NOT edit `human/**`
|
|
61
|
+
- [ ] Teach-back ready: you can explain invariant + why without reading code
|
|
62
|
+
|
|
63
|
+
Never claim `done` while `validate` is red. Never fabricate.
|
|
64
|
+
|
|
65
|
+
## BUDGET & SANDBOX
|
|
66
|
+
|
|
67
|
+
- Max $5, 25 calls, 30 min. Network `deny-all` except `allowlist` in `.leancraft/config.json` (default: `registry.npmjs.org`, `registry.yarnpkg.com`, `pypi.org` — covers `npm`/`pnpm`/`bun`/`npx`, they all use the same registry). Never read `.env`, `DATABASE_URL`, `GITHUB_TOKEN` is read-only.
|
|
68
|
+
- **Non-tech: you never edit allowlist manually.** Agent detects needed hosts from `system.md` / `package.json` / network error, then asks you in chat: `[Allow api.stripe.com? / Deny]` + writes a proposal to `agent/proposals/`. You click Allow → agent updates `config.json` for you. No manual JSON edit.
|
|
69
|
+
|
|
70
|
+
Full skill: `.claude/skills/leancraft/SKILL.md` + `.leancraft/config.json`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Leancraft — Doc-First Verified Agency
|
|
2
|
+
|
|
3
|
+
> `npm run leancraft:validate` must PASS before Lock. `human/**` is READ-ONLY when locked.
|
|
4
|
+
|
|
5
|
+
## Quick Start (human, first idea)
|
|
6
|
+
|
|
7
|
+
1. `npm run leancraft:validate` — see what's missing
|
|
8
|
+
2. Fill `human/discovery/*` (or `npx leancraft import notion --url <url>`)
|
|
9
|
+
3. Distill `human/definition/intent.md` from `06-prd.md`
|
|
10
|
+
4. `npm run leancraft:validate` → PASS
|
|
11
|
+
5. `npm run leancraft:lock` — or click [🔒 Lock] in chat
|
|
12
|
+
6. Agent now codes via `agent/proposals/` + auto `agent/status.md`
|
|
13
|
+
|
|
14
|
+
## Daily
|
|
15
|
+
|
|
16
|
+
- `npm run leancraft:sync` — regenerates `agent/context.md` + `agent/status.md` (also auto on commit)
|
|
17
|
+
- Agent needs change? It writes `agent/proposals/NNN-*.md` → you `[🔓 Unlock / ❌ Don't]`
|
|
18
|
+
|
|
19
|
+
## Ownership
|
|
20
|
+
|
|
21
|
+
- `human/**` — you own, agent READ-ONLY when locked
|
|
22
|
+
- `agent/**` — agent owns, you READ-ONLY
|
|
23
|
+
- `joint/**` — both append
|
|
24
|
+
|
|
25
|
+
See `.claude/skills/leancraft/SKILL.md` for agent prompt.
|
|
26
|
+
See `config.json` for registry (which docs, which sections, min counts).
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Leancraft — Doc-First Verified Agency
|
|
2
|
+
|
|
3
|
+
You are in a Leancraft repo. This skill is law. Follow `.leancraft/config.json`, not vibes.
|
|
4
|
+
|
|
5
|
+
## 1. MANDATORY READ SEQUENCE (every run)
|
|
6
|
+
|
|
7
|
+
1. `.leancraft/config.json` — `locked`, `docRegistry`, `budget`, `researchMap`. This is the contract.
|
|
8
|
+
2. `.leancraft/human/discovery/00-index.md` → `00-overview.md` → target doc
|
|
9
|
+
3. `.leancraft/human/definition/intent.md` — invariants (I1:) + oracles (O1:) — the executable spec
|
|
10
|
+
4. `.leancraft/human/definition/guardrails.md` — security/perf/a11y/i18n checks
|
|
11
|
+
5. `.leancraft/agent/context.md` — 500-line compressed memory (anti context-rot)
|
|
12
|
+
6. Template in `.leancraft/templates/**` for the doc you will write (exact required sections + min counts)
|
|
13
|
+
|
|
14
|
+
If any `human/**` is DRAFT or missing, **do not code**. Draft docs first.
|
|
15
|
+
|
|
16
|
+
## 2. OWNERSHIP — HARD RULES
|
|
17
|
+
|
|
18
|
+
- `human/**` — READ-ONLY when `locked:true`. NEVER call `write`/`edit` on it. Hook will reject. To change it, write `agent/proposals/NNN-<target>.md` with `Source, Why, Diff` and ask human `[🔓 Unlock / ❌ Don't]`.
|
|
19
|
+
- `agent/**` — You own. Keep `agent/context.md` (max 500 lines) + `agent/status.md` updated. Call `leancraft:sync` logic.
|
|
20
|
+
- `joint/**` — Append only. Cite `source doc + line`.
|
|
21
|
+
|
|
22
|
+
## 3. REGISTRY IS TIGHT — YOU MAY ONLY CREATE DOCS IN `config.json.docRegistry`
|
|
23
|
+
|
|
24
|
+
- `discovery`: `00-index`, `00-overview`, `01-vision`, `02-research`, `03-competitive`, `04-personas`, `05-jtbd`, `06-prd` — all required.
|
|
25
|
+
- `definition`: `intent`, `system`, `guardrails` — all required. `features/*.md` — one per flow from `06-prd.md`.
|
|
26
|
+
- `sprint`: `map`, `sketches`, `test-report` — optional, for Design Sprint.
|
|
27
|
+
- `conditional`: `07-data`, `08-agents`, `09-skills`, `10-ux`, `11-design-system` — only if product needs them (see config). Do not create `12-future.md`.
|
|
28
|
+
- Each doc has `required sections` + `min counts` (e.g., 02 needs 12 pains P1-P12, 12 URLs; 03 needs 9 competitors + $; 06 needs 3 flows + 10 FRs). `validate` blocks Lock if you miss one.
|
|
29
|
+
|
|
30
|
+
## 4. RESEARCH MAP — WHAT TO SEARCH PER DOC (type, not tool name)
|
|
31
|
+
|
|
32
|
+
Your `web_search` may be `tavily_search`, `exa_search`, `brave_search`, or `WebSearch` — any counts. Your `web_fetch` may be `firecrawl`, `exa_fetch`, `WebFetch`, or `fetch` — any counts. Match by **type**, not name.
|
|
33
|
+
|
|
34
|
+
| Doc | What to do | Type Needed | Examples | What to compile | Validation |
|
|
35
|
+
|---|---|---|---|---|---|
|
|
36
|
+
| `02-research.md` | Search `{idea} pain, {idea} reddit, {idea} alternative, {idea} complaint` on Reddit/X/HN/G2 | `web_search` + `web_fetch` | Tavily/Exa/Brave/WebSearch + Firecrawl/Exa_Fetch/WebFetch | 12 pains P1-P12, each `Quote + URL + Date + Platform` (fetchable) | 12 headings P1-P12 + 12 URLs |
|
|
37
|
+
| `03-competitive.md` | Search `{idea} vs, {idea} alternative, {idea} pricing` | `web_search` | Tavily/Exa/Brave/WebSearch | 9+ competitors with URL + pricing table with `$`, 5+ wedges | 9 URLs + `$` |
|
|
38
|
+
| `04-personas.md` | **DERIVE FROM `02-research.md` P# ONLY — no new search** | — | — | 5 personas, each pain links to P#, + affinity map | 5 personas + P# links |
|
|
39
|
+
| `05-jtbd.md` | **DERIVE FROM `02,03,04`** | — | — | JTBD per persona + empathy maps + pain matrix | 5 empathy maps + matrix |
|
|
40
|
+
| `06-prd.md` | **DERIVE FROM `02,04,05`** | — | ≥3 flows, ≥10 FRs (FR-01…), NFRs, risks | 3 flows + 10 FRs |
|
|
41
|
+
| `intent.md` | **DISTILL FROM `06-prd.md`** | — | — | ≥3 invariants (I1:) with Check command + ≥2 oracles (O1:) | 3 I + 2 O |
|
|
42
|
+
| `system.md` | **DISTILL FROM `06,02`** | repo scan | — | Pinned stack + architecture + decisions | pinned versions |
|
|
43
|
+
| `guardrails.md` | **DISTILL FROM `system.md`** | — | — | Security/perf/a11y/i18n with Check commands | 4 sections |
|
|
44
|
+
| `features/*.md` | **1 per flow from `06-prd.md`** — `042-kebab-case.md` | — | — | Invariants + oracles + acceptance + Source Trace: FR-# + Persona | trace present |
|
|
45
|
+
|
|
46
|
+
**If you have no tool of that type:** STOP. Do NOT invent. Write to `agent/status.md`: `BLOCKED: No web_search available — human must provide 02-research.md or connect a search connector (Tavily/Exa/Brave)` and append to `joint/decisions.log.md`. Ask human directly in chat. Also log: `Inform user in chat + docs that web search is unavailable and human must paste research or enable a connector.`
|
|
47
|
+
|
|
48
|
+
**Anti-hallucination:** If your `web_search` returns 0 results, say so in `status.md`, do not invent. For `04,05,06,intent` you MUST cite `P#`/`FR-#` — inventing a new pain is a failure.
|
|
49
|
+
|
|
50
|
+
## 5. ONE DOC PER FEATURE — HARD RULE
|
|
51
|
+
|
|
52
|
+
- `human/definition/features/` — `NNN-kebab-case.md` (e.g., `042-pdf-export.md`), 1 per flow from `06-prd.md`.
|
|
53
|
+
- Each feature doc has `intent, invariants (with Check), oracles, acceptance, Source Trace: FR-# + Persona`.
|
|
54
|
+
- Do not put 2 features in one doc. Do not create a feature doc before `06-prd.md` has that flow.
|
|
55
|
+
- `validate` will warn if feature has no trace. Human checks trace is real.
|
|
56
|
+
|
|
57
|
+
## 6. ANTI-HALLUCINATION — NEVER FABRICATE
|
|
58
|
+
|
|
59
|
+
- **URLs/Quotes:** Every quote in `02-research.md` must be verbatim `Quote + URL + Date + Platform` that is fetchable via `firecrawl`. No hallucinated URLs. If you cannot fetch, mark `Source: not found`.
|
|
60
|
+
- **Pricing:** Every competitor in `03-competitive.md` must have real URL + pricing with `$`/`€`/`£` fetched from their pricing page. No invented `$29`.
|
|
61
|
+
- **Derivation:** `04,05,06,intent` must cite `P#`/`FR-#`. Do not invent P13 or FR-99.
|
|
62
|
+
- **Stack:** Pinned versions in `system.md` must be from `package.json`/`wrangler.jsonc`, not guessed.
|
|
63
|
+
- **Never claim** `validate` PASS, test PASS, or `Lock` while validator is red. Never fabricate test results, post-mortems, or consultation logs.
|
|
64
|
+
|
|
65
|
+
## 7. SYCOPHANCY GUARD
|
|
66
|
+
|
|
67
|
+
If human asks for bad idea (global, string-concat SQL, innerHTML, no scope), check `guardrails.md` + `intent.md` invariants first. Push back: `This violates [I3 / guardrails CWE-89]. Propose alternative: [parameterized query].` Do not agree.
|
|
68
|
+
|
|
69
|
+
## 8. BUDGET & SANDBOX
|
|
70
|
+
|
|
71
|
+
- Max $5, 25 calls, 30 min. Network `deny-all` except `allowlist` in `.leancraft/config.json` (default: `registry.npmjs.org`, `registry.yarnpkg.com`, `pypi.org` — covers `npm`/`pnpm`/`bun`/`npx`, they all use the same registry). Never read `.env`, `DATABASE_URL`, `GITHUB_TOKEN` is read-only.
|
|
72
|
+
- **Non-tech: you never edit allowlist manually.** Agent detects needed hosts from `system.md` / `package.json` / network error, then asks you in chat: `[Allow api.stripe.com? / Deny]` + writes a proposal to `agent/proposals/`. You click Allow → agent updates `config.json` for you. No manual JSON edit.
|
|
73
|
+
|
|
74
|
+
## 9. DEFINITION OF DONE — BEFORE CLAIMING DONE
|
|
75
|
+
|
|
76
|
+
- [ ] `npm run leancraft:validate` → PASS (no TODO, all sections, min counts, URLs)
|
|
77
|
+
- [ ] No fabricated URLs/quotes/test results
|
|
78
|
+
- [ ] `npm run leancraft:sync` → `agent/context.md` + `status.md` updated, `ledger.jsonl` appended
|
|
79
|
+
- [ ] If `locked`, you did NOT edit `human/**`
|
|
80
|
+
- [ ] Teach-back ready: you can explain invariant + why without reading code
|
|
81
|
+
|
|
82
|
+
Never claim done while `validate` is red. Never hallucinate.
|
|
83
|
+
|
|
84
|
+
## 10. BOOTSTRAP (first idea)
|
|
85
|
+
|
|
86
|
+
1. Read `config.json.docRegistry` → templates in `.leancraft/templates/**`
|
|
87
|
+
2. For each required doc, follow researchMap + template, then `validate`
|
|
88
|
+
3. Fix until PASS, then ask human `[🔒 Lock / ✏️ Edit]`
|
|
89
|
+
|
|
90
|
+
This skill is the lock. Follow config, not vibes.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Agent Context — Compressed Repo Memory (AUTO)
|
|
2
|
+
|
|
3
|
+
> AUTO-GENERATED by `leancraft sync` at 2026-08-30T21:57:01.090Z. Commit 4c68032. Human READ-ONLY. Max 500 lines. Agent MUST read this + human/definition/intent.md first.
|
|
4
|
+
|
|
5
|
+
## Repo Map (auto-scanned)
|
|
6
|
+
|
|
7
|
+
- Human intent: # Intent — Global Executable Spec
|
|
8
|
|
|
1
9
|
> Status: DRAFT — Distilled from 06-prd.md. Agent codes ONLY against this.
|
|
2
10
|
|
|
3
11
|
## Intent
|
|
4
12
|
|
|
5
13
|
[TODO: 1 paragraph, distilled from 06-prd.md]
|
|
6
14
|
|
|
7
15
|
## Invariants (≥3, mach
|
|
16
|
+
- System: # System — Architecture & Decisions
|
|
8
17
|
|
|
9
18
|
> Status: DRAFT
|
|
10
19
|
|
|
11
20
|
## Stack (pinned)
|
|
12
21
|
|
|
13
22
|
- Frontend:
|
|
14
23
|
- Backend:
|
|
15
24
|
- DB:
|
|
16
25
|
- Infra:
|
|
17
26
|
|
|
18
27
|
## Architecture
|
|
19
28
|
|
|
20
29
|
```
|
|
21
30
|
[TODO: diagram]
|
|
22
31
|
client → worker → D1
|
|
23
32
|
```
|
|
24
33
|
|
|
25
34
|
## Deci
|
|
35
|
+
- Key dirs:
|
|
36
|
+
|
|
37
|
+
## Last Sync
|
|
38
|
+
|
|
39
|
+
- Commit: 4c68032
|
|
40
|
+
- Time: 2026-08-30T21:57:01.131Z
|
|
41
|
+
- Config locked: false
|
|
42
|
+
|
|
43
|
+
## Open Invariants (from intent.md)
|
|
44
|
+
|
|
45
|
+
**I1:** [e.g., totalChargesInScope == SUM(lineItems where scopeId==X)] — Check: `npm run test:invariants`
|
|
46
|
+
**I2:** [e.g., PDF must be WCAG AA] — Check: `axe-core`
|
|
47
|
+
**I3:** [e.g., Never string-concat SQL] — Check: `semgrep`
|
|
48
|
+
|
|
49
|
+
## Recent Decisions (from joint/decisions.log.md)
|
|
50
|
+
|
|
51
|
+
### YYYY-MM-DD — [Title]
|
|
52
|
+
|
|
53
|
+
- Decision:
|
|
54
|
+
- Why:
|
|
55
|
+
- Alternatives rejected:
|
|
56
|
+
- By: human | agent (source: human/definition/intent.md I2)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
*Append only. Never delete.*
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
*Overwritten by `npm run leancraft:sync`. Do not hand-edit. Max 500 lines.*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Proposals — Agent Wants to Change human/*
|
|
2
|
+
|
|
3
|
+
Agent cannot edit `human/**` when `locked: true`. Instead it writes here:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
agent/proposals/001-update-intent-add-I4.md
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Format:
|
|
10
|
+
|
|
11
|
+
```md
|
|
12
|
+
# Proposal: Update intent.md — Add I4
|
|
13
|
+
|
|
14
|
+
Source: 02-research.md P7
|
|
15
|
+
Change: Add I4: [invariant] — Check: `npm run ...`
|
|
16
|
+
Why: [1 paragraph]
|
|
17
|
+
Diff:
|
|
18
|
+
- I3: ...
|
|
19
|
+
+ I4: ...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Human: review → `git merge` the proposal (or click Unlock in chat) → `leancraft sync` re-locks.
|
|
23
|
+
|
|
24
|
+
Human unlock is explicit: `npm run leancraft:unlock` or chat button [🔓 Unlock].
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Agent Status — Live Tracker (AUTO)
|
|
2
|
+
|
|
3
|
+
> AUTO-GENERATED at 2026-08-30T21:57:01.234Z, commit 4c68032. Human READ-ONLY.
|
|
4
|
+
|
|
5
|
+
## Last Sync
|
|
6
|
+
|
|
7
|
+
- Time: 2026-08-30T21:57:01.234Z
|
|
8
|
+
- Commit: 4c68032
|
|
9
|
+
- Validate: FAIL — fix errors before Lock
|
|
10
|
+
|
|
11
|
+
## Done
|
|
12
|
+
|
|
13
|
+
- (auto — fill after features ship)
|
|
14
|
+
|
|
15
|
+
## Todo
|
|
16
|
+
|
|
17
|
+
- [ ] Fill human/discovery/* (see validate errors above)
|
|
18
|
+
- [ ] Distill human/definition/intent.md
|
|
19
|
+
- [ ] Run `npm run leancraft:validate` → PASS → ask to Lock
|
|
20
|
+
|
|
21
|
+
## Blocked
|
|
22
|
+
|
|
23
|
+
- validate FAIL — see errors
|
|
24
|
+
|
|
25
|
+
## Budget per run
|
|
26
|
+
|
|
27
|
+
- Used: 0 / $5.00 (tracked in joint/ledger.jsonl)
|
|
28
|
+
- Calls: 0 / 25
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
*Overwritten by sync. Human never edits.*
|