3.1 Collect Background Results
Wait for all background agents to complete. Gather their findings.
3.2 Generate Learnings
For each discovery, save to neotex. For multiple items, use JSONL streaming:
```bash
# Single item
echo '{"type":"TYPE","title":"TITLE","body_md":"BODY"}' | neotex add --output
# Multiple items (JSONL streaming - memory efficient)
cat <<'EOF' | neotex add --batch --format jsonl --stream --output
{"type":"decision","title":"Title 1","body_md":"..."}
{"type":"guideline","title":"Title 2","body_md":"..."}
{"type":"learning","title":"Title 3","body_md":"..."}
EOF
```
Prefer JSONL streaming when generating multiple learnings to reduce API calls.
Learning Templates
Architecture Decision:
```json
{
"type": "decision",
"title": "Uses {pattern} for {purpose}",
"body_md": "## Context\n{What problem this solves}\n\n## Decision\n{What was chosen}\n\n## Consequences\n{Trade-offs, implications}"
}
```
Code Guideline:
```json
{
"type": "guideline",
"title": "{Action verb} {what} {how}",
"body_md": "## Rule\n{The convention}\n\n## Rationale\n{Why this exists}\n\n## Examples\n``{lang}\n{good example}\n`\n\n## Anti-patterns\n`{lang}\n{bad example}\n``"
}
```
Domain Learning:
```json
{
"type": "learning",
"title": "{Entity/concept}: {key insight}",
"body_md": "## Overview\n{What this is}\n\n## Key Files\n- {path}: {purpose}\n\n## Relationships\n{How it connects to other parts}"
}
```
Command Snippet:
```json
{
"type": "snippet",
"title": "{Action}: {command}",
"body_md": "## Command\n``bash\n{command}\n``\n\n## When to Use\n{Context}\n\n## Notes\n{Gotchas, options}"
}
```
Type Mapping
| Discovery Category | Type | Focus |
|-------------------|------|-------|
| Framework/stack choices | decision | Why chosen, trade-offs |
| Architecture patterns | decision | Layers, boundaries |
| Naming conventions | guideline | Deviations from standard only |
| Error handling | guideline | Project-specific patterns |
| Testing approach | guideline | Framework, style, mocking |
| Folder structure | learning | Non-obvious organization |
| Core entities | learning | Domain model |
| Build commands | snippet | Dev workflow |
| Anti-patterns | guideline | What NOT to do |
---