- Session start step 0: read USER.md at workspace root if present - Read once at session start, not on re-anchors - ~30 token cost - USER.md.template added - README updated
4.7 KiB
SmallClaw — dev-project Skill
Trigger: Project has a brain/ directory, or user asks to start a new project.
Project Tiers
Ask at init: "Roughly how many source files?"
| Tier | Files | Brain files |
|---|---|---|
| Nano | <5 | STATUS + CONTEXT + SESSIONS |
| Small | 5–20 | + PLAN + ARCH + GLOSSARY + CHANGELOG |
Record tier in STATUS.md header. Nano skips ARCH, PLAN, GLOSSARY, CHANGELOG entirely.
Session Start Protocol
- Read
USER.md(~30 tokens) at workspace root if it exists. Sets name, tone, formatting. Read once — don't re-read on re-anchor. - Read
brain/STATUS.md(~50 tokens). Ground truth. Never skip. - Check git:
If STATUS.md SHA doesn't match git log → fix STATUS.md first.
git log --oneline -3 && git status --short && git branch --show-current - Read
brain/CONTEXT.md(~80 tokens). Your file scope. - Read only files listed in CONTEXT.md. Nothing else.
- State your plan in 2 sentences, then work.
During Work Rules
- Never edit a file you haven't read this session.
- Never invent an import or function. Read the file first. Verify it exists.
- Never commit to
main. Branch from STATUS.md current task. - If CONTEXT.md declares a module: only edit files under
Owns:. Call but don't modifyExposes:. - Commit every logical unit. Format:
type(scope): description [task: name]Types:feat,fix,refactor,docs,chore,test - Update STATUS.md checkboxes as sub-tasks complete.
- Log decisions in ARCH.md (Small tier) when choosing X over Y.
Mid-Session Re-anchor
After 15+ tool calls, or before editing any file not in CONTEXT.md: re-read STATUS.md and CONTEXT.md. This costs ~130 tokens and prevents drift when deep in work.
Session End Protocol
- Update STATUS.md — mark task done, promote next, update module health.
- Update CONTEXT.md — set scope for the next task.
- Append SESSIONS.md — max 10 bullets:
did / decided / blocked. - Commit:
chore: session end — {task} complete [v{version}] - Push. Open PR if mergeable.
CHANGELOG and version bump only when a milestone completes — not every session.
When Things Go Wrong
Lost or confused
- Re-read STATUS.md → right task?
- Re-read ARCH.md file index → does the file exist? (Small tier)
- Read last 3 SESSIONS.md entries → what happened recently?
- Re-read CONTEXT.md → in scope?
- Still stuck → stop and ask the user a specific question.
Wrong direction mid-task
Do not keep coding. Report immediately:
WRONG TURN
Expected: {what I was trying to do}
Actual: {what happened}
Changed files: {list}
Recovery: {git stash / revert / other}
Need from you: {one specific question}
Init Protocol
-
Ask:
- "What is this project? (1-2 sentences)"
- "Roughly how many source files?" → determines tier
- "Tech stack?"
- "First 3 milestones?" (Small tier)
- "Which forge? (Gitea/Forgejo/GitHub — URL?)"
-
Create
brain/with tier-appropriate files from templates. -
Create repo on forge. (See
references/forge-api.mdfor curl commands.) -
Initial commit + push.
-
Create issues matching PLAN.md milestones (Small tier).
Multi-Project Protocol
When PROJECTS.md exists at workspace root:
- Read PROJECTS.md first → active project.
- Navigate to that project's
brain/STATUS.md. - Never read another project's files unless ARCH.md lists them under Shared Dependencies.
- On project switch: quick session-end for current, then load new.
Module Protocol (Small tier only)
When ARCH.md has ## Modules:
- CONTEXT.md must declare the active module.
- Edit only files under that module's
Owns:. - Cross-module calls only via
Exposes:— read first, don't modify. - Cross-cutting concerns (security, observability) need explicit grant in CONTEXT.md.
Token Budget
| File | ~Tokens | When |
|---|---|---|
| USER.md | 30 | Session start only (not re-anchor) |
| STATUS.md | 50 | Every session start + re-anchor |
| CONTEXT.md | 80 | Every session start + re-anchor |
| ARCH.md | 120–500 | When needed (Small tier) |
| SESSIONS.md last 3 | 150 | When confused |
| PLAN.md | 200 | Scope questions (Small tier) |
| GLOSSARY.md | 100 | Domain terms (Small tier) |
Mandatory: ~130 tokens (STATUS + CONTEXT)
Size Limits
| File | Max | When exceeded |
|---|---|---|
| STATUS.md | 50 lines | Archive done tasks to SESSIONS.md |
| CONTEXT.md | 30 lines | Break task into sub-tasks |
| SESSIONS.md | 10 entries | Move older to SESSIONS-ARCHIVE.md |
| SESSIONS.md per entry | 10 bullets | Summarize |
| ARCH.md file index | 100 rows | Group into modules |
SESSIONS-ARCHIVE.md is write-only. Never read during normal work — escape hatch step 3 only.