Loading...
Loading...
Set up hierarchical Intent Layer (AGENTS.md files) for codebases. Use when initializing a new project, adding context infrastructure to an existing repo, user asks to set up AGENTS.md, add intent layer, make agents understand the codebase, or scaffolding AI-friendly project documentation.
npx skill4agent add crafter-station/skills intent-layer1. Detect state
scripts/detect_state.sh /path/to/project
→ Returns: none | partial | complete
2. Route
none/partial → Initial setup (steps 3-5)
complete → Maintenance (step 6)
3. Measure [gate - show table first]
scripts/analyze_structure.sh /path/to/project
scripts/estimate_tokens.sh /path/to/each/source/dir
4. Decide
No root file → Ask: CLAUDE.md or AGENTS.md?
Has root file → Add Intent Layer section + child nodes if needed
5. Execute
Use references/templates.md for structure
Use references/node-examples.md for real-world patterns
Validate: one root, READ-FIRST directive, <4k tokens per node
6. Maintenance mode (when state=complete)
Ask user:
a) Audit nodes → Use references/capture-protocol.md for SME questions
b) Find candidates → Re-measure tokens, suggest new nodes
c) Both| Signal | Action |
|---|---|
| >20k tokens in directory | Create AGENTS.md |
| Responsibility shift | Create AGENTS.md |
| Hidden contracts/invariants | Document in nearest ancestor |
| Cross-cutting concern | Place at LCA |
scripts/detect_state.shscripts/analyze_structure.shscripts/estimate_tokens.shreferences/templates.mdreferences/node-examples.mdreferences/capture-protocol.md