Extract tribal knowledge from your codebase into concise, documented standards. Use when you want to identify and document coding patterns, conventions, or practices that aren't formally written down.
Extract tribal knowledge from your codebase into concise, documented standards.
Check if the user specified an area via $ARGUMENTS. If they did, skip to Step 2.
If no area was specified:
I've identified these areas in your codebase:
1. **API Routes** (src/api/) — Request handling, response formats
2. **Database** (src/models/, src/db/) — Models, queries, migrations
3. **React Components** (src/components/) — UI patterns, props, state
4. **Authentication** (src/auth/) — Login, sessions, permissions
Which area should we focus on for discovering standards? (Pick one, or suggest a different area)
Wait for user response before proceeding.
Once an area is determined:
Read key files in that area (5-10 representative files)
Look for patterns that are:
Use AskUserQuestion to present findings and let user select:
I analyzed [area] and found these potential standards worth documenting:
1. **API Response Envelope** — All responses use { success, data, error } structure
2. **Error Codes** — Custom error codes like AUTH_001, DB_002 with specific meanings
3. **Pagination Pattern** — Cursor-based pagination with consistent param names
Which would you like to document?
Options:
- "Yes, all of them"
- "Just 1 and 3"
- "Add: [your suggestion]"
- "Skip this area"
Wait for user selection before proceeding.
IMPORTANT: For each selected standard, you MUST complete this full loop before moving to the next standard:
Example questions to ask (adapt based on the specific standard):
Do NOT batch all questions upfront. Process one standard at a time through the full loop.
For each standard (after completing Step 3's Q&A):
Determine the appropriate folder (create if needed):
api/, database/, javascript/, css/, backend/, testing/, global/Check if a related standard file already exists — append to it if so
Draft the content and use AskUserQuestion to confirm:
Here's the draft for api/response-format.md:
---
# API Response Format
All API responses use this envelope:
\`\`\`json
{ "success": true, "data": { ... } }
{ "success": false, "error": { "code": "...", "message": "..." } }
\`\`\`
- Never return raw data without the envelope
- Error responses must include both code and message
- Success responses omit the error field entirely
---
Create this file? (yes / edit: [your changes] / skip)
agent-os/standards/[folder]/After all standards are created:
agent-os/standards/ for all .md filesNew standard needs an index entry:
File: api/response-format.md
Suggested description: "API response envelope structure and error format"
Accept this description? (yes / or type a better one)
agent-os/standards/index.yml: