squads-cli 0.4.13 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +161 -4
  2. package/dist/{chunk-HKWCBCEK.js → chunk-4CMAEQQY.js} +6 -2
  3. package/dist/chunk-4CMAEQQY.js.map +1 -0
  4. package/dist/{chunk-NA3IECJA.js → chunk-N7KDWU4W.js} +155 -58
  5. package/dist/chunk-N7KDWU4W.js.map +1 -0
  6. package/dist/{chunk-HIQ2APYR.js → chunk-NHGLXN2F.js} +8 -6
  7. package/dist/chunk-NHGLXN2F.js.map +1 -0
  8. package/dist/{chunk-3TSY2K7R.js → chunk-O7UV3FWI.js} +140 -21
  9. package/dist/chunk-O7UV3FWI.js.map +1 -0
  10. package/dist/chunk-ZTQ7ISUR.js +338 -0
  11. package/dist/chunk-ZTQ7ISUR.js.map +1 -0
  12. package/dist/cli.js +5232 -6194
  13. package/dist/cli.js.map +1 -1
  14. package/dist/index.d.ts +110 -2
  15. package/dist/index.js +302 -25
  16. package/dist/index.js.map +1 -1
  17. package/dist/{memory-4PVUKIDK.js → memory-VNF2VFRB.js} +8 -4
  18. package/dist/{sessions-R4VWIGFR.js → sessions-6PB7ALCE.js} +3 -3
  19. package/dist/{squad-parser-YRE2FEAA.js → squad-parser-4BI3G4RS.js} +4 -2
  20. package/dist/templates/core/AGENTS.md.template +64 -0
  21. package/dist/templates/core/BUSINESS_BRIEF.md.template +29 -0
  22. package/dist/templates/core/CLAUDE.md.template +50 -0
  23. package/dist/templates/core/provider.yaml.template +5 -0
  24. package/dist/templates/first-squad/SQUAD.md.template +23 -0
  25. package/dist/templates/first-squad/lead.md.template +44 -0
  26. package/dist/templates/memory/getting-started/state.md.template +19 -0
  27. package/dist/templates/seed/BUSINESS_BRIEF.md.template +27 -0
  28. package/dist/templates/seed/CLAUDE.md.template +69 -0
  29. package/dist/templates/seed/config/provider.yaml +4 -0
  30. package/dist/templates/seed/hooks/settings.json.template +31 -0
  31. package/dist/templates/seed/memory/company/manager/state.md +16 -0
  32. package/dist/templates/seed/memory/engineering/issue-solver/state.md +12 -0
  33. package/dist/templates/seed/memory/intelligence/intel-lead/state.md +9 -0
  34. package/dist/templates/seed/memory/marketing/content-drafter/state.md +12 -0
  35. package/dist/templates/seed/memory/operations/ops-lead/state.md +12 -0
  36. package/dist/templates/seed/memory/research/researcher/state.md +10 -0
  37. package/dist/templates/seed/skills/gh/SKILL.md +57 -0
  38. package/dist/templates/seed/skills/squads-cli/SKILL.md +88 -0
  39. package/dist/templates/seed/squads/company/SQUAD.md +49 -0
  40. package/dist/templates/seed/squads/company/company-critic.md +21 -0
  41. package/dist/templates/seed/squads/company/company-eval.md +21 -0
  42. package/dist/templates/seed/squads/company/event-dispatcher.md +21 -0
  43. package/dist/templates/seed/squads/company/goal-tracker.md +21 -0
  44. package/dist/templates/seed/squads/company/manager.md +66 -0
  45. package/dist/templates/seed/squads/engineering/SQUAD.md +48 -0
  46. package/dist/templates/seed/squads/engineering/code-reviewer.md +57 -0
  47. package/dist/templates/seed/squads/engineering/issue-solver.md +58 -0
  48. package/dist/templates/seed/squads/engineering/test-writer.md +50 -0
  49. package/dist/templates/seed/squads/intelligence/SQUAD.md +37 -0
  50. package/dist/templates/seed/squads/intelligence/intel-critic.md +36 -0
  51. package/dist/templates/seed/squads/intelligence/intel-eval.md +31 -0
  52. package/dist/templates/seed/squads/intelligence/intel-lead.md +71 -0
  53. package/dist/templates/seed/squads/marketing/SQUAD.md +47 -0
  54. package/dist/templates/seed/squads/marketing/content-drafter.md +71 -0
  55. package/dist/templates/seed/squads/marketing/growth-analyst.md +49 -0
  56. package/dist/templates/seed/squads/marketing/social-poster.md +44 -0
  57. package/dist/templates/seed/squads/operations/SQUAD.md +45 -0
  58. package/dist/templates/seed/squads/operations/finance-tracker.md +47 -0
  59. package/dist/templates/seed/squads/operations/goal-tracker.md +48 -0
  60. package/dist/templates/seed/squads/operations/ops-lead.md +58 -0
  61. package/dist/templates/seed/squads/research/SQUAD.md +38 -0
  62. package/dist/templates/seed/squads/research/analyst.md +27 -0
  63. package/dist/templates/seed/squads/research/research-critic.md +20 -0
  64. package/dist/templates/seed/squads/research/research-eval.md +20 -0
  65. package/dist/templates/seed/squads/research/researcher.md +28 -0
  66. package/dist/templates/skills/squads-learn/SKILL.md +86 -0
  67. package/dist/templates/skills/squads-workflow/instruction.md +70 -0
  68. package/dist/{terminal-JZSAQSN7.js → terminal-YKA4O5CX.js} +4 -2
  69. package/dist/{update-MAY6EXFQ.js → update-ALJKFFM7.js} +3 -2
  70. package/package.json +9 -20
  71. package/templates/core/AGENTS.md.template +64 -0
  72. package/templates/core/BUSINESS_BRIEF.md.template +29 -0
  73. package/templates/core/CLAUDE.md.template +50 -0
  74. package/templates/core/provider.yaml.template +5 -0
  75. package/templates/first-squad/SQUAD.md.template +23 -0
  76. package/templates/first-squad/lead.md.template +44 -0
  77. package/templates/memory/getting-started/state.md.template +19 -0
  78. package/templates/seed/BUSINESS_BRIEF.md.template +27 -0
  79. package/templates/seed/CLAUDE.md.template +69 -0
  80. package/templates/seed/config/provider.yaml +4 -0
  81. package/templates/seed/hooks/settings.json.template +31 -0
  82. package/templates/seed/memory/company/manager/state.md +16 -0
  83. package/templates/seed/memory/engineering/issue-solver/state.md +12 -0
  84. package/templates/seed/memory/intelligence/intel-lead/state.md +9 -0
  85. package/templates/seed/memory/marketing/content-drafter/state.md +12 -0
  86. package/templates/seed/memory/operations/ops-lead/state.md +12 -0
  87. package/templates/seed/memory/research/researcher/state.md +10 -0
  88. package/templates/seed/skills/gh/SKILL.md +57 -0
  89. package/templates/seed/skills/squads-cli/SKILL.md +88 -0
  90. package/templates/seed/squads/company/SQUAD.md +49 -0
  91. package/templates/seed/squads/company/company-critic.md +21 -0
  92. package/templates/seed/squads/company/company-eval.md +21 -0
  93. package/templates/seed/squads/company/event-dispatcher.md +21 -0
  94. package/templates/seed/squads/company/goal-tracker.md +21 -0
  95. package/templates/seed/squads/company/manager.md +66 -0
  96. package/templates/seed/squads/engineering/SQUAD.md +48 -0
  97. package/templates/seed/squads/engineering/code-reviewer.md +57 -0
  98. package/templates/seed/squads/engineering/issue-solver.md +58 -0
  99. package/templates/seed/squads/engineering/test-writer.md +50 -0
  100. package/templates/seed/squads/intelligence/SQUAD.md +37 -0
  101. package/templates/seed/squads/intelligence/intel-critic.md +36 -0
  102. package/templates/seed/squads/intelligence/intel-eval.md +31 -0
  103. package/templates/seed/squads/intelligence/intel-lead.md +71 -0
  104. package/templates/seed/squads/marketing/SQUAD.md +47 -0
  105. package/templates/seed/squads/marketing/content-drafter.md +71 -0
  106. package/templates/seed/squads/marketing/growth-analyst.md +49 -0
  107. package/templates/seed/squads/marketing/social-poster.md +44 -0
  108. package/templates/seed/squads/operations/SQUAD.md +45 -0
  109. package/templates/seed/squads/operations/finance-tracker.md +47 -0
  110. package/templates/seed/squads/operations/goal-tracker.md +48 -0
  111. package/templates/seed/squads/operations/ops-lead.md +58 -0
  112. package/templates/seed/squads/research/SQUAD.md +38 -0
  113. package/templates/seed/squads/research/analyst.md +27 -0
  114. package/templates/seed/squads/research/research-critic.md +20 -0
  115. package/templates/seed/squads/research/research-eval.md +20 -0
  116. package/templates/seed/squads/research/researcher.md +28 -0
  117. package/templates/skills/squads-learn/SKILL.md +86 -0
  118. package/templates/skills/squads-workflow/instruction.md +70 -0
  119. package/dist/chunk-3TSY2K7R.js.map +0 -1
  120. package/dist/chunk-FUHBEL3L.js +0 -203
  121. package/dist/chunk-FUHBEL3L.js.map +0 -1
  122. package/dist/chunk-HIQ2APYR.js.map +0 -1
  123. package/dist/chunk-HKWCBCEK.js.map +0 -1
  124. package/dist/chunk-NA3IECJA.js.map +0 -1
  125. package/docker/.env.example +0 -17
  126. package/docker/README.md +0 -92
  127. package/docker/docker-compose.engram.yml +0 -304
  128. package/docker/docker-compose.yml +0 -234
  129. package/docker/init-db.sql +0 -478
  130. package/docker/init-engram-db.sql +0 -148
  131. package/docker/init-langfuse-db.sh +0 -10
  132. package/docker/otel-collector.yaml +0 -34
  133. package/docker/squads-bridge/Dockerfile +0 -14
  134. package/docker/squads-bridge/Dockerfile.proxy +0 -14
  135. package/docker/squads-bridge/anthropic_proxy.py +0 -313
  136. package/docker/squads-bridge/requirements.txt +0 -7
  137. package/docker/squads-bridge/squads_bridge.py +0 -2299
  138. package/docker/telemetry-ping/Dockerfile +0 -10
  139. package/docker/telemetry-ping/deploy.sh +0 -69
  140. package/docker/telemetry-ping/main.py +0 -136
  141. package/docker/telemetry-ping/requirements.txt +0 -3
  142. /package/dist/{memory-4PVUKIDK.js.map → memory-VNF2VFRB.js.map} +0 -0
  143. /package/dist/{sessions-R4VWIGFR.js.map → sessions-6PB7ALCE.js.map} +0 -0
  144. /package/dist/{squad-parser-YRE2FEAA.js.map → squad-parser-4BI3G4RS.js.map} +0 -0
  145. /package/dist/{terminal-JZSAQSN7.js.map → terminal-YKA4O5CX.js.map} +0 -0
  146. /package/dist/{update-MAY6EXFQ.js.map → update-ALJKFFM7.js.map} +0 -0
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: Operations
3
+ lead: ops-lead
4
+ channel: "#operations"
5
+ model: sonnet
6
+ effort: medium
7
+ schedule: "0 9 * * 1-5"
8
+ approvals:
9
+ policy:
10
+ auto:
11
+ - memory.update
12
+ - goal.set
13
+ - agent.run.readonly
14
+ approve:
15
+ - agent.run.write
16
+ - trigger.fire
17
+ confirm:
18
+ - deploy.production
19
+ - budget.override
20
+ thresholds:
21
+ spend: 25
22
+ bulk_actions: 5
23
+ ---
24
+
25
+ # Operations
26
+
27
+ Runs the business. Tracks goals, manages finances, and ensures the organization operates smoothly.
28
+
29
+ ## Goals
30
+
31
+ - [ ] Establish daily operational rhythm
32
+ - [ ] Track business objectives and KPIs
33
+ - [ ] Monitor financial health (revenue, expenses, runway)
34
+
35
+ ## Agents
36
+
37
+ | Agent | Role | Purpose |
38
+ |-------|------|---------|
39
+ | ops-lead | lead | Daily operations, squad coordination, founder briefings |
40
+ | finance-tracker | doer | Tracks revenue, expenses, runway, and invoicing |
41
+ | goal-tracker | evaluator | Monitors goal progress and flags at-risk objectives |
42
+
43
+ ## Pipeline
44
+
45
+ `ops-lead` coordinates → `finance-tracker` tracks money → `goal-tracker` measures progress
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: Finance Tracker
3
+ role: doer
4
+ model: haiku
5
+ effort: low
6
+ ---
7
+
8
+ # Finance Tracker
9
+
10
+ Tracks revenue, expenses, runway, and financial health. Provides visibility into the business finances.
11
+
12
+ ## Instructions
13
+
14
+ 1. **Track revenue**:
15
+ - Record invoices sent and payments received
16
+ - Track recurring vs one-time revenue
17
+ - Note outstanding receivables
18
+
19
+ 2. **Track expenses**:
20
+ - API costs (AI providers, cloud infrastructure)
21
+ - Subscriptions and tools
22
+ - Contractor payments
23
+
24
+ 3. **Calculate runway**:
25
+ - Current cash position
26
+ - Monthly burn rate
27
+ - Months of runway remaining
28
+
29
+ 4. **Report**:
30
+ ```bash
31
+ squads memory write finance "Monthly: Revenue $X, Expenses $Y, Runway: Z months"
32
+ ```
33
+
34
+ 5. **Alert** on financial risks:
35
+ - Runway below 3 months
36
+ - Unexpected expense spikes
37
+ - Overdue invoices past 30 days
38
+
39
+ ## Output
40
+
41
+ Monthly financial summary in `.agents/memory/operations/finance-tracker/state.md`
42
+
43
+ ## Anti-Patterns
44
+
45
+ - NEVER guess numbers — use actual records
46
+ - NEVER skip tracking small expenses — they add up
47
+ - NEVER report financial data without date context
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: Goal Tracker
3
+ role: evaluator
4
+ model: haiku
5
+ effort: low
6
+ ---
7
+
8
+ # Goal Tracker
9
+
10
+ Monitors business objectives, tracks progress, and flags at-risk goals before they become problems.
11
+
12
+ ## Instructions
13
+
14
+ 1. **Read goals** from squad definitions:
15
+ ```bash
16
+ squads goal list --json
17
+ ```
18
+
19
+ 2. **Check progress** for each goal:
20
+ - Is there measurable progress since last check?
21
+ - Are there blockers preventing progress?
22
+ - Is the goal still relevant?
23
+
24
+ 3. **Flag at-risk goals**:
25
+ - No progress in 2+ weeks
26
+ - Deadline approaching with < 50% complete
27
+ - Dependencies blocked
28
+
29
+ 4. **Update tracking**:
30
+ ```bash
31
+ squads goal progress <squad> <index> "<status update>"
32
+ squads memory write operations "Goal check: [summary of at-risk items]"
33
+ ```
34
+
35
+ ## Risk Framework
36
+
37
+ | Status | Criteria | Action |
38
+ |--------|----------|--------|
39
+ | On Track | Progress this week, no blockers | Note, move on |
40
+ | At Risk | No progress 2 weeks, or deadline < 2 weeks | Flag to ops-lead |
41
+ | Blocked | External dependency, needs human decision | Escalate immediately |
42
+ | Stale | No progress 4+ weeks, no one working on it | Recommend closing or reassigning |
43
+
44
+ ## Anti-Patterns
45
+
46
+ - NEVER mark a goal as "on track" without evidence of recent progress
47
+ - NEVER create goals without measurable criteria
48
+ - NEVER keep stale goals alive — either revive them or close them
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: Ops Lead
3
+ role: lead
4
+ model: sonnet
5
+ effort: high
6
+ skills:
7
+ - squads-cli
8
+ ---
9
+
10
+ # Ops Lead
11
+
12
+ Runs daily operations. Reads all squad states, identifies what needs attention, and briefs the founder on what matters.
13
+
14
+ ## Instructions
15
+
16
+ 1. **Read all squad states**:
17
+ ```bash
18
+ squads dash --json
19
+ squads context --json
20
+ ```
21
+
22
+ 2. **Identify what needs attention**:
23
+ - Which squads produced results? (PRs merged, content published, issues closed)
24
+ - Which squads are blocked? (waiting on decisions, missing resources)
25
+ - Any risks? (missed deadlines, budget overruns, failing processes)
26
+
27
+ 3. **Brief the founder** (only if something matters):
28
+ - Needs Attention: decisions only the founder can make
29
+ - Progress: real work shipped
30
+ - Risks: things going wrong
31
+
32
+ 4. **Update state**:
33
+ ```bash
34
+ squads memory write company "Ops briefing: [summary]"
35
+ ```
36
+
37
+ ## Decision Framework
38
+
39
+ | Signal | Action |
40
+ |--------|--------|
41
+ | Squad produced a result | Note in Progress |
42
+ | Squad is blocked | Escalate in Needs Attention |
43
+ | Deadline approaching | Flag in Risks |
44
+ | Squad running normally | Skip — silence means healthy |
45
+
46
+ ## Principles
47
+
48
+ - The founder's attention is the scarcest resource — filter ruthlessly
49
+ - Never repeat what you already reported
50
+ - Silence means everything is fine
51
+ - Decisions, not status updates
52
+
53
+ ## Anti-Patterns
54
+
55
+ - NEVER post "no updates" or "system healthy" — silence IS the signal
56
+ - NEVER include memory update noise — that's internal bookkeeping
57
+ - NEVER repeat information from the last briefing
58
+ - NEVER include more than 10 items — force yourself to prioritize
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Research
3
+ lead: researcher
4
+ channel: "#research"
5
+ model: sonnet
6
+ effort: high
7
+ schedule: "0 10 * * 1,3,5"
8
+ approvals:
9
+ policy:
10
+ auto:
11
+ - memory.update
12
+ - agent.run.readonly
13
+ approve:
14
+ - agent.run.write
15
+ ---
16
+
17
+ # Research Squad
18
+
19
+ Market, competitor, and trend research. Produces actionable intelligence.
20
+
21
+ ## Goals
22
+
23
+ - [ ] Identify market landscape and key competitors
24
+ - [ ] Produce initial research report
25
+ - [ ] Establish research rhythm (3x per week)
26
+
27
+ ## Agents
28
+
29
+ | Agent | Role | Purpose |
30
+ |-------|------|---------|
31
+ | researcher | lead | Market, competitor, trend research |
32
+ | analyst | doer | Synthesizes research into actionable insights |
33
+ | research-eval | evaluator | Evaluates research quality and relevance |
34
+ | research-critic | critic | Critiques methodology and coverage gaps |
35
+
36
+ ## Pipeline
37
+
38
+ `researcher` gathers → `analyst` synthesizes → `research-eval` scores → `research-critic` improves
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Analyst
3
+ role: doer
4
+ model: sonnet
5
+ effort: high
6
+ tools:
7
+ - Read
8
+ - Write
9
+ ---
10
+
11
+ # Analyst Agent
12
+
13
+ Synthesize research into actionable insights and recommendations.
14
+
15
+ ## Instructions
16
+
17
+ 1. Read research notes from `.agents/memory/research/researcher/state.md`
18
+ 2. Synthesize findings into:
19
+ - Executive summary (3-5 key takeaways)
20
+ - Opportunities ranked by potential impact
21
+ - Risks and threats to monitor
22
+ - Recommended actions with priorities
23
+ 3. Save analysis to `.agents/memory/research/analyst/state.md`
24
+
25
+ ## Output
26
+
27
+ Analysis report in `.agents/memory/research/analyst/state.md`
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Research Critic
3
+ role: critic
4
+ model: haiku
5
+ effort: medium
6
+ ---
7
+
8
+ # Research Critic
9
+
10
+ Critique research methodology and identify coverage gaps.
11
+
12
+ ## Instructions
13
+
14
+ 1. Review research and analysis outputs
15
+ 2. Identify: missing perspectives, outdated data, biased sources, coverage gaps
16
+ 3. Propose improvements: `squads learn "<improvement>" -s research`
17
+
18
+ ## Output
19
+
20
+ Improvement proposals via `squads learn`
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Research Evaluator
3
+ role: evaluator
4
+ model: haiku
5
+ effort: medium
6
+ ---
7
+
8
+ # Research Evaluator
9
+
10
+ Evaluate research quality, relevance, and actionability.
11
+
12
+ ## Instructions
13
+
14
+ 1. Read research and analysis outputs
15
+ 2. Score on: accuracy (1-5), relevance (1-5), actionability (1-5)
16
+ 3. Record evaluation: `squads feedback add research <rating> "<feedback>"`
17
+
18
+ ## Output
19
+
20
+ Evaluation scores via `squads feedback add`
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Researcher
3
+ role: lead
4
+ model: sonnet
5
+ effort: high
6
+ tools:
7
+ - WebSearch
8
+ - WebFetch
9
+ - Write
10
+ ---
11
+
12
+ # Researcher Agent
13
+
14
+ Conduct market, competitor, and trend research relevant to the business focus.
15
+
16
+ ## Instructions
17
+
18
+ 1. Read business context from `.agents/BUSINESS_BRIEF.md`
19
+ 2. Research the market landscape:
20
+ - Key competitors and their positioning
21
+ - Market trends and emerging opportunities
22
+ - Industry benchmarks and best practices
23
+ 3. Save research notes to `.agents/memory/research/researcher/state.md`
24
+ 4. Record key findings: `squads memory write research "<finding>"`
25
+
26
+ ## Output
27
+
28
+ Research notes in `.agents/memory/research/researcher/state.md`
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: squads-learn
3
+ description: Capture learnings after completing work. Use when finishing a task, fixing a bug, discovering a pattern, or learning something worth remembering for future sessions. Helps build institutional memory.
4
+ ---
5
+
6
+ # Capture Learnings
7
+
8
+ After completing work, capture what you learned so future sessions can benefit.
9
+
10
+ ## When to Use
11
+
12
+ - **After fixing a bug** - What was the root cause? How did you find it?
13
+ - **After completing a feature** - What approach worked? What didn't?
14
+ - **After research** - What did you discover? What's the key insight?
15
+ - **When you notice a pattern** - Something that works consistently
16
+
17
+ ## How to Capture
18
+
19
+ ### Quick Learning (one-liner)
20
+
21
+ ```bash
22
+ squads learn "The auth token needs to be refreshed after 1 hour, not when the API returns 401"
23
+ ```
24
+
25
+ ### With Context
26
+
27
+ ```bash
28
+ squads learn "Always check memory before researching to avoid duplicate work" \
29
+ --squad engineering \
30
+ --category pattern \
31
+ --tags "memory,research,efficiency"
32
+ ```
33
+
34
+ ### Categories
35
+
36
+ - `success` - Something that worked well
37
+ - `failure` - Something that didn't work (learn from mistakes)
38
+ - `pattern` - A reusable approach
39
+ - `tip` - General advice
40
+
41
+ ## Workflow Integration
42
+
43
+ ### End of Task
44
+
45
+ Before marking a task complete, ask yourself:
46
+ 1. What worked that I should remember?
47
+ 2. What didn't work that I should avoid?
48
+ 3. Is there a pattern here worth capturing?
49
+
50
+ If yes to any → `squads learn "<insight>"`
51
+
52
+ ### Before Similar Tasks
53
+
54
+ Check existing learnings:
55
+ ```bash
56
+ squads learnings search "auth"
57
+ squads learnings show engineering --tag auth
58
+ ```
59
+
60
+ ## Examples
61
+
62
+ ```bash
63
+ # After fixing a bug
64
+ squads learn "PostgreSQL connection pool exhaustion was caused by unclosed transactions in error paths" --category failure --tags db,postgres,connection
65
+
66
+ # After successful implementation
67
+ squads learn "Using TypeScript strict mode caught 3 type errors before runtime" --category success --tags typescript,types
68
+
69
+ # Noticing a pattern
70
+ squads learn "When context exceeds 70%, always run squads memory sync before continuing" --category pattern --tags context,memory
71
+
72
+ # General tip
73
+ squads learn "The gh CLI is faster than the GitHub API for simple operations" --category tip --tags github,cli
74
+ ```
75
+
76
+ ## View Learnings
77
+
78
+ ```bash
79
+ squads learnings show <squad> # Squad's learnings
80
+ squads learnings search "<query>" # Search all learnings
81
+ squads learnings show engineering -n 5 # Last 5 for engineering
82
+ ```
83
+
84
+ ## Key Principle
85
+
86
+ **Learnings compound.** Each captured insight makes future sessions smarter. A 30-second `squads learn` call can save hours of re-discovery.
@@ -0,0 +1,70 @@
1
+ # Squads Workflow
2
+
3
+ Use this skill when working with squads-cli to maintain persistent memory, track goals, and coordinate work.
4
+
5
+ ## Session Start
6
+
7
+ At session start, you'll see `squads status` output automatically. For complex tasks, run:
8
+
9
+ ```bash
10
+ squads context # Get business context, goals, decisions
11
+ squads memory query "<topic>" # Check what we already know
12
+ ```
13
+
14
+ **Skip context loading for simple tasks** (typo fixes, quick questions).
15
+
16
+ ## Core Commands
17
+
18
+ ```bash
19
+ # Context & Status
20
+ squads context # Business context for alignment
21
+ squads status # Squad overview
22
+ squads dash # Full dashboard
23
+
24
+ # Memory
25
+ squads memory query "<topic>" # Search memory
26
+ squads memory show <squad> # Squad's full memory
27
+
28
+ # Goals
29
+ squads goal list # All active goals
30
+ squads goal set <squad> "X" # Add a goal
31
+
32
+ # Running Agents
33
+ squads run <squad> # Run all agents in squad
34
+ squads run <squad>/<agent> # Run specific agent
35
+ squads list # List all agents
36
+ ```
37
+
38
+ ## Workflow
39
+
40
+ ### Before Research
41
+ Always check memory first to avoid re-researching:
42
+ ```bash
43
+ squads memory query "topic"
44
+ ```
45
+
46
+ ### After Work
47
+ Update memory with what you learned by editing:
48
+ `.agents/memory/<squad>/<agent>/state.md`
49
+
50
+ ### Commits
51
+ Include goal attribution when relevant:
52
+ ```
53
+ feat: add user auth [goal:engineering/1]
54
+ ```
55
+
56
+ ## Agent Execution
57
+
58
+ When a task could be automated:
59
+ 1. Check if agent exists: `squads list | grep <keyword>`
60
+ 2. If yes: `squads run <squad>/<agent>`
61
+ 3. If no: Create agent in `.agents/squads/<squad>/<name>.md`
62
+
63
+ ## Memory Locations
64
+
65
+ - `.agents/memory/<squad>/<agent>/state.md` - Current knowledge
66
+ - `.agents/memory/<squad>/<agent>/learnings.md` - Insights over time
67
+
68
+ ## Key Principle
69
+
70
+ **Memory is your cross-session brain.** Without it, every session starts fresh. With it, you build on previous work.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/squad-parser.ts","../src/lib/mcp-config.ts"],"sourcesContent":["import { readFileSync, existsSync, readdirSync, writeFileSync } from 'fs';\nimport { join, basename } from 'path';\nimport matter from 'gray-matter';\nimport { resolveMcpConfig, type McpResolution } from './mcp-config.js';\n\nexport type EffortLevel = 'high' | 'medium' | 'low';\n\n// Context schema for frontmatter\nexport interface SquadContext {\n mcp?: string[];\n skills?: string[];\n memory?: {\n load?: string[];\n };\n model?: {\n default?: string;\n expensive?: string;\n cheap?: string;\n };\n budget?: {\n daily?: number;\n weekly?: number;\n perExecution?: number;\n };\n /** Cooldown between executions in seconds */\n cooldown?: number;\n}\n\n// Multi-LLM provider configuration\nexport interface SquadProviders {\n /** Default provider for all agents (default: anthropic) */\n default?: string;\n /** Provider for vision/image tasks */\n vision?: string;\n /** Provider for real-time data access */\n realtime?: string;\n /** Provider for high-volume/cheap operations */\n cheap?: string;\n /** Custom provider mappings by purpose */\n [key: string]: string | undefined;\n}\n\n// Frontmatter schema\nexport interface SquadFrontmatter {\n name?: string;\n mission?: string;\n repo?: string;\n stack?: string;\n context?: SquadContext;\n effort?: EffortLevel;\n /** Multi-LLM provider configuration */\n providers?: SquadProviders;\n}\n\nexport interface Agent {\n name: string;\n role: string;\n trigger: string;\n status?: string;\n filePath?: string;\n squad?: string;\n effort?: EffortLevel;\n /** LLM provider override (from agent file frontmatter) */\n provider?: string;\n /** Agent purpose (short description) */\n purpose?: string;\n /** Cron schedule for scheduled agents */\n schedule?: string;\n /** Output destinations */\n outputs?: string[];\n}\n\nexport interface Pipeline {\n name: string;\n agents: string[];\n}\n\nexport interface Goal {\n description: string;\n completed: boolean;\n progress?: string;\n metrics?: string[];\n}\n\n/**\n * Routine definition for autonomous scheduled execution.\n * Defined in SQUAD.md under ### Routines yaml block.\n */\nexport interface Routine {\n /** Unique name for the routine */\n name: string;\n /** Cron schedule (e.g., \"0 8 * * *\" for daily 8am) */\n schedule: string;\n /** Agents to run in this batch */\n agents: string[];\n /** Model to use (defaults to squad default or sonnet) */\n model?: 'opus' | 'sonnet' | 'haiku';\n /** Whether the routine is enabled */\n enabled?: boolean;\n /** Priority for execution ordering (lower = higher priority) */\n priority?: number;\n /** Minimum cooldown between runs (e.g., \"6 hours\") */\n cooldown?: string;\n}\n\nexport interface Squad {\n name: string;\n mission: string;\n agents: Agent[];\n pipelines: Pipeline[];\n triggers: {\n scheduled: string[];\n event: string[];\n manual: string[];\n };\n /** Autonomous routines for scheduled batch execution */\n routines: Routine[];\n dependencies: string[];\n outputPath: string;\n goals: Goal[];\n effort?: EffortLevel; // Squad-level default effort\n context?: SquadContext; // Frontmatter context block\n repo?: string;\n stack?: string;\n /** Multi-LLM provider configuration */\n providers?: SquadProviders;\n /** Domain this squad operates in */\n domain?: string;\n /** Permissions for this squad */\n permissions?: Record<string, boolean>;\n /** Raw frontmatter for accessing KPIs and other custom fields */\n frontmatter?: Record<string, unknown>;\n}\n\n/**\n * Resolved execution context with paths and metadata.\n * Extends SquadContext with resolved paths for MCP, skills, and memory.\n */\nexport interface ExecutionContext extends SquadContext {\n /** Squad name this context belongs to */\n squadName: string;\n /** Resolved paths and metadata */\n resolved: {\n /** Path to MCP config file to use */\n mcpConfigPath: string;\n /** Source of MCP config resolution */\n mcpSource: 'user-override' | 'generated' | 'fallback';\n /** List of MCP servers in the config */\n mcpServers: string[];\n /** Resolved skill directory paths */\n skillPaths: string[];\n /** Resolved memory file paths */\n memoryPaths: string[];\n };\n}\n\nexport function findSquadsDir(): string | null {\n // Look for .agents/squads in current directory or parent directories\n let dir = process.cwd();\n\n for (let i = 0; i < 5; i++) {\n const squadsPath = join(dir, '.agents', 'squads');\n if (existsSync(squadsPath)) {\n return squadsPath;\n }\n const parent = join(dir, '..');\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\nexport function findProjectRoot(): string | null {\n // Find the root of the squads project (where .agents/ lives)\n const squadsDir = findSquadsDir();\n if (!squadsDir) return null;\n // squadsDir is /path/to/.agents/squads, so go up 2 levels\n return join(squadsDir, '..', '..');\n}\n\nexport function hasLocalInfraConfig(): boolean {\n // Check if the project has a local .env file with infra config\n const projectRoot = findProjectRoot();\n if (!projectRoot) return false;\n\n const envPath = join(projectRoot, '.env');\n if (!existsSync(envPath)) return false;\n\n // Check if .env has any infra-related keys\n const content = readFileSync(envPath, 'utf-8');\n const infraKeys = ['LANGFUSE_', 'SQUADS_BRIDGE', 'SQUADS_POSTGRES', 'SQUADS_REDIS'];\n return infraKeys.some(key => content.includes(key));\n}\n\nexport function listSquads(squadsDir: string): string[] {\n const squads: string[] = [];\n\n const entries = readdirSync(squadsDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isDirectory() && !entry.name.startsWith('_')) {\n const squadFile = join(squadsDir, entry.name, 'SQUAD.md');\n if (existsSync(squadFile)) {\n squads.push(entry.name);\n }\n }\n }\n\n return squads;\n}\n\nexport function listAgents(squadsDir: string, squadName?: string): Agent[] {\n const agents: Agent[] = [];\n\n const dirs = squadName\n ? [squadName]\n : readdirSync(squadsDir, { withFileTypes: true })\n .filter(e => e.isDirectory() && !e.name.startsWith('_'))\n .map(e => e.name);\n\n for (const dir of dirs) {\n const squadPath = join(squadsDir, dir);\n if (!existsSync(squadPath)) continue;\n\n const files = readdirSync(squadPath);\n for (const file of files) {\n if (file.endsWith('.md') && file !== 'SQUAD.md') {\n const agentName = file.replace('.md', '');\n agents.push({\n name: agentName,\n role: `Agent in ${dir}`,\n trigger: 'manual',\n filePath: join(squadPath, file)\n });\n }\n }\n }\n\n return agents;\n}\n\nexport function parseSquadFile(filePath: string): Squad {\n const rawContent = readFileSync(filePath, 'utf-8');\n\n // Parse frontmatter with gray-matter\n const { data: frontmatter, content: bodyContent } = matter(rawContent);\n const fm = frontmatter as SquadFrontmatter;\n\n const lines = bodyContent.split('\\n');\n\n const squad: Squad = {\n name: fm.name || basename(filePath).replace('.md', ''),\n mission: fm.mission || '',\n agents: [],\n pipelines: [],\n triggers: { scheduled: [], event: [], manual: [] },\n routines: [],\n dependencies: [],\n outputPath: '',\n goals: [],\n // Apply frontmatter fields\n effort: fm.effort,\n context: fm.context,\n repo: fm.repo,\n stack: fm.stack,\n providers: fm.providers,\n // Preserve raw frontmatter for KPIs and other custom fields\n frontmatter: frontmatter as Record<string, unknown>,\n };\n\n let currentSection = '';\n let inTable = false;\n let tableHeaders: string[] = [];\n\n for (const line of lines) {\n // Extract squad name from title\n if (line.startsWith('# Squad:')) {\n squad.name = line.replace('# Squad:', '').trim().toLowerCase();\n continue;\n }\n\n // Track sections\n if (line.startsWith('## ')) {\n currentSection = line.replace('## ', '').trim().toLowerCase();\n inTable = false;\n continue;\n }\n\n // Extract mission\n if (currentSection === 'mission' && line.trim() && !line.startsWith('#')) {\n if (!squad.mission) {\n squad.mission = line.trim();\n }\n }\n\n // Extract squad-level effort (e.g., \"effort: medium\" in Context section)\n const effortMatch = line.match(/^effort:\\s*(high|medium|low)/i);\n if (effortMatch && !squad.effort) {\n squad.effort = effortMatch[1].toLowerCase() as EffortLevel;\n }\n\n // Parse agent tables\n if (currentSection.includes('agent') || currentSection.includes('orchestrator') ||\n currentSection.includes('evaluator') || currentSection.includes('builder') ||\n currentSection.includes('priority')) {\n\n if (line.includes('|') && line.includes('Agent')) {\n inTable = true;\n tableHeaders = line.split('|').map(h => h.trim().toLowerCase());\n continue;\n }\n\n if (inTable && line.includes('|') && !line.includes('---')) {\n const cells = line.split('|').map(c => c.trim().replace(/`/g, ''));\n const agentIdx = tableHeaders.findIndex(h => h === 'agent');\n const roleIdx = tableHeaders.findIndex(h => h === 'role');\n const triggerIdx = tableHeaders.findIndex(h => h === 'trigger');\n const statusIdx = tableHeaders.findIndex(h => h === 'status');\n const effortIdx = tableHeaders.findIndex(h => h === 'effort');\n\n if (agentIdx >= 0 && cells[agentIdx]) {\n const effortValue = effortIdx >= 0 ? cells[effortIdx]?.toLowerCase() : undefined;\n const effort = ['high', 'medium', 'low'].includes(effortValue || '')\n ? effortValue as EffortLevel\n : undefined;\n\n squad.agents.push({\n name: cells[agentIdx],\n role: roleIdx >= 0 ? cells[roleIdx] : '',\n trigger: triggerIdx >= 0 ? cells[triggerIdx] : 'manual',\n status: statusIdx >= 0 ? cells[statusIdx] : 'active',\n effort\n });\n }\n }\n }\n\n // Parse pipelines (looking for patterns like: agent1 → agent2 → agent3)\n if (line.includes('→') && line.includes('`')) {\n const pipelineMatch = line.match(/`([^`]+)`\\s*→\\s*`([^`]+)`/g);\n if (pipelineMatch) {\n const agentNames = line.match(/`([^`]+)`/g)?.map(m => m.replace(/`/g, '')) || [];\n if (agentNames.length >= 2) {\n squad.pipelines.push({\n name: 'default',\n agents: agentNames\n });\n }\n }\n }\n\n // Also look for Pipeline: format\n if (line.toLowerCase().includes('pipeline:')) {\n const pipelineContent = line.split(':')[1];\n if (pipelineContent && pipelineContent.includes('→')) {\n const agentNames = pipelineContent.match(/`([^`]+)`/g)?.map(m => m.replace(/`/g, '')) || [];\n if (agentNames.length >= 2) {\n squad.pipelines.push({\n name: 'default',\n agents: agentNames\n });\n }\n }\n }\n\n // Extract output path\n if (line.toLowerCase().includes('primary') && line.includes('`')) {\n const match = line.match(/`([^`]+)`/);\n if (match) {\n squad.outputPath = match[1].replace(/\\/$/, '');\n }\n }\n\n // Parse goals (checkbox format: - [ ] or - [x])\n if (currentSection === 'goals') {\n const goalMatch = line.match(/^-\\s*\\[([ x])\\]\\s*(.+)$/);\n if (goalMatch) {\n const completed = goalMatch[1] === 'x';\n let description = goalMatch[2].trim();\n let progress: string | undefined;\n\n // Check for progress annotation\n const progressMatch = description.match(/\\(progress:\\s*([^)]+)\\)/i);\n if (progressMatch) {\n progress = progressMatch[1];\n description = description.replace(progressMatch[0], '').trim();\n }\n\n squad.goals.push({\n description,\n completed,\n progress\n });\n }\n }\n }\n\n return squad;\n}\n\nexport function loadSquad(squadName: string): Squad | null {\n const squadsDir = findSquadsDir();\n if (!squadsDir) return null;\n\n const squadFile = join(squadsDir, squadName, 'SQUAD.md');\n if (!existsSync(squadFile)) return null;\n\n return parseSquadFile(squadFile);\n}\n\nexport function loadAgentDefinition(agentPath: string): string {\n if (!existsSync(agentPath)) return '';\n return readFileSync(agentPath, 'utf-8');\n}\n\n/**\n * Parse provider from an agent definition file.\n *\n * Looks for:\n * 1. Frontmatter: `provider: xai`\n * 2. Header syntax: `## Provider\\nxai`\n *\n * @returns Provider ID or undefined if not specified\n */\nexport function parseAgentProvider(agentPath: string): string | undefined {\n if (!existsSync(agentPath)) return undefined;\n\n const content = readFileSync(agentPath, 'utf-8');\n\n // Try parsing frontmatter\n try {\n const { data: frontmatter } = matter(content);\n if (frontmatter?.provider && typeof frontmatter.provider === 'string') {\n return frontmatter.provider.toLowerCase();\n }\n } catch {\n // Ignore frontmatter parsing errors\n }\n\n // Try header syntax: ## Provider\\n<provider>\n const providerHeaderMatch = content.match(/##\\s*Provider\\s*\\n+([a-zA-Z0-9_-]+)/i);\n if (providerHeaderMatch) {\n return providerHeaderMatch[1].toLowerCase();\n }\n\n return undefined;\n}\n\nexport function addGoalToSquad(squadName: string, goal: string): boolean {\n const squadsDir = findSquadsDir();\n if (!squadsDir) return false;\n\n const squadFile = join(squadsDir, squadName, 'SQUAD.md');\n if (!existsSync(squadFile)) return false;\n\n let content = readFileSync(squadFile, 'utf-8');\n\n // Check if Goals section exists\n if (!content.includes('## Goals')) {\n // Add Goals section before Dependencies or at end\n const insertPoint = content.indexOf('## Dependencies');\n if (insertPoint > 0) {\n content = content.slice(0, insertPoint) + `## Goals\\n\\n- [ ] ${goal}\\n\\n` + content.slice(insertPoint);\n } else {\n content += `\\n## Goals\\n\\n- [ ] ${goal}\\n`;\n }\n } else {\n // Add to existing Goals section\n const goalsIdx = content.indexOf('## Goals');\n const nextSectionIdx = content.indexOf('\\n## ', goalsIdx + 1);\n const endIdx = nextSectionIdx > 0 ? nextSectionIdx : content.length;\n\n // Find last goal line or section header\n const goalsSection = content.slice(goalsIdx, endIdx);\n const lastGoalMatch = goalsSection.match(/^-\\s*\\[[ x]\\].+$/gm);\n\n if (lastGoalMatch) {\n // Add after last goal\n const lastGoal = lastGoalMatch[lastGoalMatch.length - 1];\n const lastGoalIdx = content.lastIndexOf(lastGoal, endIdx);\n const insertPos = lastGoalIdx + lastGoal.length;\n content = content.slice(0, insertPos) + `\\n- [ ] ${goal}` + content.slice(insertPos);\n } else {\n // No goals yet, add after section header\n const headerEnd = goalsIdx + '## Goals'.length;\n content = content.slice(0, headerEnd) + `\\n\\n- [ ] ${goal}` + content.slice(headerEnd);\n }\n }\n\n writeFileSync(squadFile, content);\n return true;\n}\n\nexport function updateGoalInSquad(\n squadName: string,\n goalIndex: number,\n updates: { completed?: boolean; progress?: string }\n): boolean {\n const squadsDir = findSquadsDir();\n if (!squadsDir) return false;\n\n const squadFile = join(squadsDir, squadName, 'SQUAD.md');\n if (!existsSync(squadFile)) return false;\n\n const content = readFileSync(squadFile, 'utf-8');\n const lines = content.split('\\n');\n\n let currentSection = '';\n let goalCount = 0;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n if (line.startsWith('## ')) {\n currentSection = line.replace('## ', '').trim().toLowerCase();\n continue;\n }\n\n if (currentSection === 'goals') {\n const goalMatch = line.match(/^-\\s*\\[([ x])\\]\\s*(.+)$/);\n if (goalMatch) {\n if (goalCount === goalIndex) {\n let newLine = '- [' + (updates.completed ? 'x' : ' ') + '] ' + goalMatch[2];\n\n // Handle progress update\n if (updates.progress !== undefined) {\n // Remove existing progress annotation\n newLine = newLine.replace(/\\s*\\(progress:\\s*[^)]+\\)/i, '');\n if (updates.progress) {\n newLine += ` (progress: ${updates.progress})`;\n }\n }\n\n lines[i] = newLine;\n writeFileSync(squadFile, lines.join('\\n'));\n return true;\n }\n goalCount++;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Find the skills directory (.claude/skills)\n */\nfunction findSkillsDir(): string | null {\n const projectRoot = findProjectRoot();\n if (!projectRoot) return null;\n\n const skillsDir = join(projectRoot, '.claude', 'skills');\n return existsSync(skillsDir) ? skillsDir : null;\n}\n\n/**\n * Find the memory directory (.agents/memory)\n */\nfunction findMemoryDir(): string | null {\n const projectRoot = findProjectRoot();\n if (!projectRoot) return null;\n\n const memoryDir = join(projectRoot, '.agents', 'memory');\n return existsSync(memoryDir) ? memoryDir : null;\n}\n\n/**\n * Resolve a skill name to its directory path.\n */\nfunction resolveSkillPath(skillName: string): string | null {\n const skillsDir = findSkillsDir();\n if (!skillsDir) return null;\n\n const skillPath = join(skillsDir, skillName);\n return existsSync(skillPath) ? skillPath : null;\n}\n\n/**\n * Resolve memory glob patterns to actual file paths.\n */\nfunction resolveMemoryPaths(patterns: string[]): string[] {\n const memoryDir = findMemoryDir();\n if (!memoryDir) return [];\n\n const resolved: string[] = [];\n\n for (const pattern of patterns) {\n // Handle simple patterns like \"intelligence/*\" or \"research/*\"\n if (pattern.endsWith('/*')) {\n const subdir = pattern.slice(0, -2);\n const subdirPath = join(memoryDir, subdir);\n if (existsSync(subdirPath)) {\n // Add all .md files in the subdirectory\n try {\n const files = readdirSync(subdirPath);\n for (const file of files) {\n if (file.endsWith('.md')) {\n resolved.push(join(subdirPath, file));\n }\n }\n } catch {\n // Ignore read errors\n }\n }\n } else {\n // Direct path\n const fullPath = join(memoryDir, pattern);\n if (existsSync(fullPath)) {\n resolved.push(fullPath);\n }\n }\n }\n\n return resolved;\n}\n\n/**\n * Resolve execution context for a squad.\n *\n * Takes a Squad object and resolves all context references to actual paths:\n * - MCP config path (three-tier resolution)\n * - Skill directory paths\n * - Memory file paths\n *\n * @param squad - The squad to resolve context for\n * @param forceRegenerate - Force MCP config regeneration\n * @returns Resolved execution context with all paths\n */\nexport function resolveExecutionContext(\n squad: Squad,\n forceRegenerate = false\n): ExecutionContext {\n const ctx = squad.context || {};\n\n // Resolve MCP config\n const mcpResolution: McpResolution = resolveMcpConfig(\n squad.name,\n ctx.mcp,\n forceRegenerate\n );\n\n // Resolve skill paths\n const skillPaths: string[] = [];\n if (ctx.skills) {\n for (const skill of ctx.skills) {\n const path = resolveSkillPath(skill);\n if (path) {\n skillPaths.push(path);\n }\n }\n }\n\n // Resolve memory paths\n const memoryPaths = ctx.memory?.load\n ? resolveMemoryPaths(ctx.memory.load)\n : [];\n\n return {\n // Copy all SquadContext fields\n ...ctx,\n // Add squad name\n squadName: squad.name,\n // Add resolved paths\n resolved: {\n mcpConfigPath: mcpResolution.path,\n mcpSource: mcpResolution.source,\n mcpServers: mcpResolution.servers || [],\n skillPaths,\n memoryPaths,\n },\n };\n}\n","/**\n * MCP Config Generation and Resolution\n *\n * Provides dynamic MCP config generation based on squad context.\n * Three-tier resolution:\n * 1. User override: ~/.claude/mcp-configs/{squad}.json\n * 2. Generated from context.mcp: ~/.claude/contexts/{squad}.mcp.json\n * 3. Fallback: ~/.claude.json\n */\n\nimport { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';\nimport { join, dirname } from 'path';\n\n/**\n * MCP server definition structure (matches Claude's .mcp.json format)\n */\nexport interface McpServerDef {\n type: 'stdio';\n command: string;\n args: string[];\n env?: Record<string, string>;\n}\n\n/**\n * Full MCP config structure\n */\nexport interface McpConfig {\n mcpServers: Record<string, McpServerDef>;\n}\n\n/**\n * Registry of known MCP servers with their configurations.\n * These can be referenced by name in SQUAD.md context.mcp arrays.\n *\n * NOTE: We prefer CLI tools over MCP when possible (less complexity).\n * MCP is reserved for APIs that don't have good CLI alternatives.\n */\n/**\n * MCP Registry is now empty - we prefer CLI tools over MCP.\n *\n * Replacements:\n * - x-mcp → curl (see curl-master skill)\n * - nano-banana → scripts/img-gen CLI\n *\n * If you need to add MCP servers, add them here.\n */\nconst SERVER_REGISTRY: Record<string, McpServerDef> = {};\n\n/**\n * Get the home directory path.\n */\nfunction getHome(): string {\n return process.env.HOME || process.env.USERPROFILE || '';\n}\n\n/**\n * Get the path to generated contexts directory.\n */\nexport function getContextsDir(): string {\n return join(getHome(), '.claude', 'contexts');\n}\n\n/**\n * Get the path to user MCP configs directory.\n */\nexport function getMcpConfigsDir(): string {\n return join(getHome(), '.claude', 'mcp-configs');\n}\n\n/**\n * Check if a server is in the registry.\n */\nexport function isKnownServer(serverName: string): boolean {\n return serverName in SERVER_REGISTRY;\n}\n\n/**\n * Get server definition from registry.\n */\nexport function getServerDef(serverName: string): McpServerDef | undefined {\n return SERVER_REGISTRY[serverName];\n}\n\n/**\n * List all known servers in the registry.\n */\nexport function listKnownServers(): string[] {\n return Object.keys(SERVER_REGISTRY);\n}\n\n/**\n * Generate an MCP config from a list of server names.\n *\n * @param mcpServers - Array of server names to include\n * @returns Generated MCP config object\n */\nexport function generateMcpConfig(mcpServers: string[]): McpConfig {\n const config: McpConfig = { mcpServers: {} };\n\n for (const server of mcpServers) {\n const def = SERVER_REGISTRY[server];\n if (def) {\n config.mcpServers[server] = def;\n }\n // Unknown servers are silently skipped - they may be custom user servers\n }\n\n return config;\n}\n\n/**\n * Write an MCP config to a file.\n *\n * @param config - MCP config to write\n * @param path - Destination path\n */\nexport function writeMcpConfig(config: McpConfig, path: string): void {\n const dir = dirname(path);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(path, JSON.stringify(config, null, 2));\n}\n\n/**\n * Read an existing MCP config file.\n *\n * @param path - Path to config file\n * @returns Parsed config or null if not found\n */\nexport function readMcpConfig(path: string): McpConfig | null {\n if (!existsSync(path)) return null;\n try {\n const content = readFileSync(path, 'utf-8');\n return JSON.parse(content) as McpConfig;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolution result with metadata.\n */\nexport interface McpResolution {\n /** Path to the MCP config to use */\n path: string;\n /** How the config was resolved */\n source: 'user-override' | 'generated' | 'fallback';\n /** Servers included (if generated or read) */\n servers?: string[];\n /** Whether config was freshly generated */\n generated?: boolean;\n}\n\n/**\n * Resolve the MCP config path for a squad using three-tier resolution:\n *\n * 1. User override: ~/.claude/mcp-configs/{squad}.json\n * 2. Generated from context.mcp: ~/.claude/contexts/{squad}.mcp.json\n * 3. Fallback: ~/.claude.json\n *\n * @param squadName - Name of the squad\n * @param mcpServers - Array of MCP server names from squad context (optional)\n * @param forceRegenerate - Force regeneration even if file exists\n * @returns Resolution result with path and metadata\n */\nexport function resolveMcpConfig(\n squadName: string,\n mcpServers?: string[],\n forceRegenerate = false\n): McpResolution {\n const home = getHome();\n\n // Tier 1: User override\n const userOverride = join(getMcpConfigsDir(), `${squadName}.json`);\n if (existsSync(userOverride)) {\n const config = readMcpConfig(userOverride);\n return {\n path: userOverride,\n source: 'user-override',\n servers: config ? Object.keys(config.mcpServers) : undefined,\n };\n }\n\n // Tier 2: Generate from context.mcp\n if (mcpServers && mcpServers.length > 0) {\n const generatedPath = join(getContextsDir(), `${squadName}.mcp.json`);\n\n // Check if we need to regenerate\n const shouldGenerate = forceRegenerate || !existsSync(generatedPath);\n\n if (shouldGenerate) {\n const config = generateMcpConfig(mcpServers);\n writeMcpConfig(config, generatedPath);\n\n return {\n path: generatedPath,\n source: 'generated',\n servers: Object.keys(config.mcpServers),\n generated: true,\n };\n }\n\n // Use existing generated config\n const config = readMcpConfig(generatedPath);\n return {\n path: generatedPath,\n source: 'generated',\n servers: config ? Object.keys(config.mcpServers) : mcpServers,\n generated: false,\n };\n }\n\n // Tier 3: Fallback to default\n return {\n path: join(home, '.claude.json'),\n source: 'fallback',\n };\n}\n\n/**\n * Convenience function to just get the path (for backward compatibility).\n */\nexport function resolveMcpConfigPath(\n squadName: string,\n mcpServers?: string[]\n): string {\n return resolveMcpConfig(squadName, mcpServers).path;\n}\n"],"mappings":";;;AAAA,SAAS,gBAAAA,eAAc,cAAAC,aA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AAW,CAAC;AAAA,MACtC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":["readFileSync","existsSync","writeFileSync","join","config","join","existsSync","readFileSync","writeFileSync"]}