# Three ways patterns enter the library:
1. MANUAL CURATION (primary method)
Developer writes pattern YAML directly by analyzing their projects.
No automation needed — just encode what you know.
mahavishnu patterns create --name "auth" --from-project splashstand
2. AI SUGGESTION (builds on code indexing spec)
After code graph exists (spec 3), extractor analyzes symbol graph
to find recurring structures across repos:
mahavishnu patterns suggest --repos fastblocks,splashstand
→ "Detected auth pattern in 2/2 repos: session middleware,
login route, user model, CSRF protection. Create pattern?"
3. CONVERSATION CAPTURE (builds on session-buddy)
After successfully building a Fastblocks app via chat, Mahavishnu
can offer to extract the generated structure as a reusable pattern:
→ "This app used auth + dashboard + Cloud Run patterns.
Save as a new composite pattern?"
AI Suggestion details:
- Input: code graph from spec 3 (symbols, edges, directory structure)
- Detection: cluster projects by structural similarity (shared directory layouts, similar adapter registrations, common import patterns)
- Output: proposed pattern YAML with confidence score — shown to human for approval or rejection
- Does NOT: auto-save to library. Always requires human approval.
The AI suggestion is a time-saver, not an autonomous agent. It drafts the YAML, the human reviews and edits it before it enters the library.