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 20ca47ad31 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:37 +00:00

6.8 KiB
Raw Permalink Blame History

SmallClawPlus — dev-project Skill

Trigger: Project has a brain/ directory, or user asks to start a new project.

Extends SmallClaw with: error capture, self-improving learnings, dependency tracking.


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 + DEPS
Large 20+ + full module protocol + .learnings/

Record tier in STATUS.md header. Nano skips ARCH, PLAN, DEPS, .learnings/ 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. Check pending errors (Small+ tier):
    wc -l brain/.learnings/ERRORS.md 2>/dev/null
    
    If >5 pending errors, scan for patterns before starting work.
  6. Read only files listed in CONTEXT.md. Nothing else.
  7. 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 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. Costs ~130 tokens, prevents drift.


Session End Protocol

  1. Update STATUS.md — mark task done, promote next, update module health + learnings backlog count.
  2. Update CONTEXT.md — set scope for the next task.
  3. Self-reflect: What went wrong? What took too long? What would I do differently?
  4. Append SESSIONS.md — max 10 bullets: did / decided / blocked / learned.
  5. Push. Open PR if mergeable.

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


Learnings System (Small+ tier)

Capture

When something goes wrong or you discover a gotcha:

  • Errors → brain/.learnings/ERRORS.md — what broke, root cause, fix
  • Learnings → brain/.learnings/LEARNINGS.md — patterns, gotchas, "always do X"
  • Feature requests → brain/.learnings/FEATURE_REQUESTS.md — user asked for this

Tag each entry with [area: {module or topic}] for filtering.

Promotion

At session end, check if any learning has recurred 3+ times:

  • Project-specific → promote to ARCH.md Decisions Log
  • Workspace-wide pattern → suggest promoting to SOUL.md or AGENTS.md

Never put project-specific learnings in SOUL.md. Never put workspace patterns in ARCH.md.

Filtering

At session start, CONTEXT.md has a Relevant Learnings field. Only read learnings matching the current area tag. Budget: ~50 tokens.

Archives

When ERRORS.md or LEARNINGS.md exceed 20 entries, move resolved/promoted entries to ERRORS-ARCHIVE.md / LEARNINGS-ARCHIVE.md. Archives are write-only — escape hatch only.


Dependency Tracking (Small+ tier)

DEPS.md

Tracks module dependencies as structured markdown:

## Import Graph
| Source | Depends on | Interface |
|---|---|---|

## Breaking Changes
| Date | Module | Change | Affected |
|---|---|---|---|

Update DEPS.md when adding cross-module imports. Check DEPS.md Affected column before changing any interface.

When DEPS.md exceeds 50 rows, use it to auto-generate the Blast radius field in CONTEXT.md.


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?
  3. Check brain/.learnings/ERRORS.md → seen this before?
  4. Read last 3 SESSIONS.md entries → what happened recently?
  5. Re-read CONTEXT.md → in scope?
  6. 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}

Log the error in .learnings/ERRORS.md.


Init Protocol

  1. Ask:

    • "What is this project? (1-2 sentences)"
    • "Roughly how many source files?" → determines tier
    • "Tech stack?"
    • "First 3 milestones?"
    • "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.


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)

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.
  • Update DEPS.md when adding cross-module imports.

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
Pending errors count 10 Session start
Area-filtered learnings 50 Session start (when relevant)
ARCH.md 120–500 When needed
DEPS.md 100–300 Cross-module work
SESSIONS.md last 3 150 When confused

Mandatory: ~140 tokens (STATUS + CONTEXT). Learnings scan adds ~60, still under 200.


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
ERRORS.md 20 entries Move resolved to ERRORS-ARCHIVE.md
LEARNINGS.md 20 entries Promote or archive
DEPS.md 50 rows per table Query instead of scanning

Archives are write-only. Never read during normal work — escape hatch step 4 only.