This repository has been archived on 2026-10-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Dragon a591d050b3 feat: add USER.md support
- 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
2026-04-02 20:35:36 +00:00

4.7 KiB
Raw Permalink Blame History

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

  1. Read USER.md (~30 tokens) at workspace root if it exists. Sets name, tone, formatting. Read once — don't re-read on re-anchor.
  2. Read brain/STATUS.md (~50 tokens). Ground truth. Never skip.
  3. Check git:
    git log --oneline -3 && git status --short && git branch --show-current
    
    If STATUS.md SHA doesn't match git log → fix STATUS.md first.
  4. Read brain/CONTEXT.md (~80 tokens). Your file scope.
  5. Read only files listed in CONTEXT.md. Nothing else.
  6. 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 modify Exposes:.
  • 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

  1. Update STATUS.md — mark task done, promote next, update module health.
  2. Update CONTEXT.md — set scope for the next task.
  3. Append SESSIONS.md — max 10 bullets: did / decided / blocked.
  4. Commit: chore: session end — {task} complete [v{version}]
  5. Push. Open PR if mergeable.

CHANGELOG and version bump only when a milestone completes — not every session.


When Things Go Wrong

Lost or confused

  1. Re-read STATUS.md → right task?
  2. Re-read ARCH.md file index → does the file exist? (Small tier)
  3. Read last 3 SESSIONS.md entries → what happened recently?
  4. Re-read CONTEXT.md → in scope?
  5. 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

  1. 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?)"
  2. Create brain/ with tier-appropriate files from templates.

  3. Create repo on forge. (See references/forge-api.md for curl commands.)

  4. Initial commit + push.

  5. Create issues matching PLAN.md milestones (Small tier).


Multi-Project Protocol

When PROJECTS.md exists at workspace root:

  1. Read PROJECTS.md first → active project.
  2. Navigate to that project's brain/STATUS.md.
  3. Never read another project's files unless ARCH.md lists them under Shared Dependencies.
  4. 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.