arkaos 2.0.0 → 2.0.1

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 (86) hide show
  1. package/README.md +100 -74
  2. package/VERSION +1 -1
  3. package/bin/arkaos +1 -1
  4. package/core/__pycache__/__init__.cpython-313.pyc +0 -0
  5. package/core/agents/__pycache__/__init__.cpython-313.pyc +0 -0
  6. package/core/agents/__pycache__/loader.cpython-313.pyc +0 -0
  7. package/core/agents/__pycache__/schema.cpython-313.pyc +0 -0
  8. package/core/agents/__pycache__/validator.cpython-313.pyc +0 -0
  9. package/core/conclave/__pycache__/__init__.cpython-313.pyc +0 -0
  10. package/core/conclave/__pycache__/advisor_db.cpython-313.pyc +0 -0
  11. package/core/conclave/__pycache__/display.cpython-313.pyc +0 -0
  12. package/core/conclave/__pycache__/matcher.cpython-313.pyc +0 -0
  13. package/core/conclave/__pycache__/persistence.cpython-313.pyc +0 -0
  14. package/core/conclave/__pycache__/profiler.cpython-313.pyc +0 -0
  15. package/core/conclave/__pycache__/prompts.cpython-313.pyc +0 -0
  16. package/core/conclave/__pycache__/schema.cpython-313.pyc +0 -0
  17. package/core/governance/__pycache__/__init__.cpython-313.pyc +0 -0
  18. package/core/governance/__pycache__/constitution.cpython-313.pyc +0 -0
  19. package/core/registry/__pycache__/__init__.cpython-313.pyc +0 -0
  20. package/core/registry/__pycache__/generator.cpython-313.pyc +0 -0
  21. package/core/runtime/__pycache__/__init__.cpython-313.pyc +0 -0
  22. package/core/runtime/__pycache__/base.cpython-313.pyc +0 -0
  23. package/core/runtime/__pycache__/claude_code.cpython-313.pyc +0 -0
  24. package/core/runtime/__pycache__/codex_cli.cpython-313.pyc +0 -0
  25. package/core/runtime/__pycache__/cursor.cpython-313.pyc +0 -0
  26. package/core/runtime/__pycache__/gemini_cli.cpython-313.pyc +0 -0
  27. package/core/runtime/__pycache__/registry.cpython-313.pyc +0 -0
  28. package/core/runtime/__pycache__/subagent.cpython-313.pyc +0 -0
  29. package/core/specs/__pycache__/__init__.cpython-313.pyc +0 -0
  30. package/core/specs/__pycache__/manager.cpython-313.pyc +0 -0
  31. package/core/specs/__pycache__/schema.cpython-313.pyc +0 -0
  32. package/core/squads/__pycache__/__init__.cpython-313.pyc +0 -0
  33. package/core/squads/__pycache__/loader.cpython-313.pyc +0 -0
  34. package/core/squads/__pycache__/registry.cpython-313.pyc +0 -0
  35. package/core/squads/__pycache__/schema.cpython-313.pyc +0 -0
  36. package/core/synapse/__pycache__/__init__.cpython-313.pyc +0 -0
  37. package/core/synapse/__pycache__/cache.cpython-313.pyc +0 -0
  38. package/core/synapse/__pycache__/engine.cpython-313.pyc +0 -0
  39. package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
  40. package/core/tasks/__pycache__/__init__.cpython-313.pyc +0 -0
  41. package/core/tasks/__pycache__/manager.cpython-313.pyc +0 -0
  42. package/core/tasks/__pycache__/schema.cpython-313.pyc +0 -0
  43. package/core/workflow/__pycache__/__init__.cpython-313.pyc +0 -0
  44. package/core/workflow/__pycache__/engine.cpython-313.pyc +0 -0
  45. package/core/workflow/__pycache__/loader.cpython-313.pyc +0 -0
  46. package/core/workflow/__pycache__/schema.cpython-313.pyc +0 -0
  47. package/departments/dev/skills/agent-design/SKILL.md +4 -0
  48. package/departments/dev/skills/agent-design/references/architecture-patterns.md +223 -0
  49. package/departments/dev/skills/ai-security/SKILL.md +4 -0
  50. package/departments/dev/skills/ai-security/references/prompt-injection-catalog.md +230 -0
  51. package/departments/dev/skills/ci-cd-pipeline/SKILL.md +4 -0
  52. package/departments/dev/skills/ci-cd-pipeline/references/github-actions-patterns.md +202 -0
  53. package/departments/dev/skills/db-schema/SKILL.md +4 -0
  54. package/departments/dev/skills/db-schema/references/indexing-strategy.md +197 -0
  55. package/departments/dev/skills/dependency-audit/SKILL.md +4 -0
  56. package/departments/dev/skills/dependency-audit/references/license-matrix.md +191 -0
  57. package/departments/dev/skills/incident/SKILL.md +4 -0
  58. package/departments/dev/skills/incident/references/severity-playbook.md +221 -0
  59. package/departments/dev/skills/observability/SKILL.md +4 -0
  60. package/departments/dev/skills/observability/references/slo-design.md +200 -0
  61. package/departments/dev/skills/rag-architect/SKILL.md +5 -0
  62. package/departments/dev/skills/rag-architect/references/chunking-strategies.md +129 -0
  63. package/departments/dev/skills/rag-architect/references/evaluation-guide.md +158 -0
  64. package/departments/dev/skills/red-team/SKILL.md +4 -0
  65. package/departments/dev/skills/red-team/references/mitre-attack-web.md +165 -0
  66. package/departments/dev/skills/security-audit/SKILL.md +4 -0
  67. package/departments/dev/skills/security-audit/references/owasp-2025-deep.md +409 -0
  68. package/departments/dev/skills/security-compliance/SKILL.md +117 -0
  69. package/departments/finance/skills/ciso-advisor/SKILL.md +4 -0
  70. package/departments/finance/skills/ciso-advisor/references/compliance-roadmap.md +172 -0
  71. package/departments/marketing/skills/programmatic-seo/SKILL.md +4 -0
  72. package/departments/marketing/skills/programmatic-seo/references/template-playbooks.md +289 -0
  73. package/departments/ops/skills/gdpr-compliance/SKILL.md +104 -0
  74. package/departments/ops/skills/iso27001/SKILL.md +113 -0
  75. package/departments/ops/skills/quality-management/SKILL.md +118 -0
  76. package/departments/ops/skills/risk-management/SKILL.md +120 -0
  77. package/departments/ops/skills/soc2-compliance/SKILL.md +120 -0
  78. package/departments/strategy/skills/cto-advisor/SKILL.md +4 -0
  79. package/departments/strategy/skills/cto-advisor/references/build-vs-buy-framework.md +190 -0
  80. package/installer/cli.js +13 -2
  81. package/installer/index.js +1 -2
  82. package/installer/migrate.js +123 -0
  83. package/installer/update.js +28 -15
  84. package/package.json +1 -1
  85. package/pyproject.toml +1 -1
  86. package/core/agents/__pycache__/registry_gen.cpython-313.pyc +0 -0
package/README.md CHANGED
@@ -1,22 +1,25 @@
1
1
  # ArkaOS
2
2
 
3
- **The Operating System for AI Agent Teams.** 56 specialized agents across 16 departments, backed by 116 enterprise frameworks. One install. Full company capability.
3
+ **The Operating System for AI Agent Teams.** 62 agents across 17 departments, 250+ skills backed by 116 enterprise frameworks, 8 Python CLI tools. One install.
4
4
 
5
5
  ```
6
6
  npx arkaos install
7
7
  ```
8
8
 
9
+ [![Tests](https://github.com/andreagroferreira/arka-os/actions/workflows/test.yml/badge.svg)](https://github.com/andreagroferreira/arka-os/actions) [![npm](https://img.shields.io/npm/v/arkaos)](https://www.npmjs.com/package/arkaos) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
+
9
11
  ## What ArkaOS Does
10
12
 
11
- ArkaOS orchestrates AI agents that cover every business function. Not just code. Marketing, brand, finance, strategy, sales, operations, product management, e-commerce, communities, content, and more.
13
+ ArkaOS orchestrates AI agents that cover every business function. Not just code. Marketing, brand, finance, strategy, sales, operations, compliance, product management, e-commerce, communities, content, and more.
12
14
 
13
- Each agent has a defined role, personality, expertise, and authority level. They work in squads, follow structured workflows, and every output passes through a mandatory Quality Gate before reaching you.
15
+ Each agent has a defined role, personality, expertise, and authority level. They work in squads, follow YAML workflows, and every output passes through a mandatory Quality Gate.
14
16
 
15
17
  ```
16
18
  You: "validate my saas idea for a scheduling tool"
19
+
17
20
  ArkaOS: → Routes to SaaS department
18
21
  → Tiago (SaaS Strategist) leads validation workflow
19
- → Market sizing, competitor analysis, business model, pricing, MVP scope
22
+ → Market sizing, competitor analysis, business model, pricing
20
23
  → Financial viability check by Leonor (Financial Analyst)
21
24
  → Quality Gate: Marta, Eduardo, Francisca review
22
25
  → Delivers: validated report with go/no-go recommendation
@@ -25,108 +28,127 @@ ArkaOS: → Routes to SaaS department
25
28
  ## Install
26
29
 
27
30
  ```bash
28
- # Auto-detects your AI runtime
29
- npx arkaos install
30
-
31
- # Or specify the runtime
31
+ npx arkaos install # auto-detects runtime
32
32
  npx arkaos install --runtime claude-code
33
33
  npx arkaos install --runtime codex
34
34
  npx arkaos install --runtime gemini
35
35
  npx arkaos install --runtime cursor
36
36
  ```
37
37
 
38
- Requires: Node.js 18+ and Python 3.11+
39
-
40
- ## 16 Departments, 56 Agents
41
-
42
- | Department | Prefix | Agents | What It Does |
43
- |-----------|--------|--------|-------------|
44
- | Development | `/dev` | 9 | Features, APIs, architecture, security, CI/CD, testing |
45
- | Marketing | `/mkt` | 4 | SEO, paid ads, content, email, growth loops |
46
- | Brand & Design | `/brand` | 4 | Brand identity, UX/UI, design systems, naming |
47
- | Finance | `/fin` | 3 | Financial models, valuation, fundraising, unit economics |
48
- | Strategy | `/strat` | 3 | Five Forces, Blue Ocean, BMC, competitive intelligence |
49
- | E-Commerce | `/ecom` | 4 | Store optimization, CRO, RFM, pricing, marketplace |
50
- | Knowledge | `/kb` | 3 | Research, Zettelkasten, personas, Obsidian curation |
51
- | Operations | `/ops` | 2 | Automation (n8n, Zapier), SOPs, bottleneck analysis |
52
- | Project Mgmt | `/pm` | 3 | Scrum, Kanban, Shape Up, discovery, roadmaps |
53
- | SaaS | `/saas` | 3 | Validation, metrics, PLG, pricing, customer success |
54
- | Landing Pages | `/landing` | 4 | Sales copy, funnels, offers, launches, affiliates |
55
- | Content | `/content` | 4 | Viral design, hooks, scripts, repurposing (1 to 30+) |
56
- | Communities | `/community` | 2 | Telegram, Discord, Skool groups, membership monetization |
57
- | Sales | `/sales` | 2 | Pipeline, proposals, SPIN selling, negotiation |
58
- | Leadership | `/lead` | 2 | Team health, hiring, feedback, OKRs, culture |
59
- | Organization | `/org` | 1 | Org design, team topologies, scaling operations |
60
- | **Quality Gate** | (auto) | 3 | Mandatory review on every workflow. Veto power. |
38
+ Requires Node.js 18+ and Python 3.11+.
39
+
40
+ **Upgrading from v1?** Run `npx arkaos migrate`
41
+
42
+ ## 17 Departments, 62 Agents
43
+
44
+ | Department | Prefix | Agents | Skills | What It Does |
45
+ |-----------|--------|--------|--------|-------------|
46
+ | Development | `/dev` | 9 | 41 | Features, APIs, architecture, security, CI/CD, RAG, agents |
47
+ | Marketing | `/mkt` | 4 | 14 | SEO, paid ads, email, growth loops, programmatic SEO |
48
+ | Brand & Design | `/brand` | 4 | 12 | Brand identity, UX/UI, design systems, naming |
49
+ | Finance | `/fin` | 3 | 8 | DCF valuation, unit economics, CISO advisory |
50
+ | Strategy | `/strat` | 3 | 9 | Five Forces, Blue Ocean, BMC, CTO/board advisory |
51
+ | E-Commerce | `/ecom` | 4 | 12 | Store optimization, CRO, RFM, pricing |
52
+ | Knowledge | `/kb` | 3 | 12 | Research, Zettelkasten, personas, Obsidian |
53
+ | Operations | `/ops` | 2 | 15 | Automation, SOPs, GDPR, ISO 27001, SOC 2, risk |
54
+ | Project Mgmt | `/pm` | 3 | 13 | Scrum, Shape Up, discovery, agile PO |
55
+ | SaaS | `/saas` | 3 | 15 | Validation, metrics, PLG, scaffolding |
56
+ | Landing Pages | `/landing` | 4 | 15 | Sales copy, funnels, offers, page generation |
57
+ | Content | `/content` | 4 | 14 | Viral design, hooks, scripts, repurposing |
58
+ | Communities | `/community` | 2 | 14 | Groups, membership, gamification |
59
+ | Sales | `/sales` | 2 | 10 | Pipeline, SPIN selling, negotiation |
60
+ | Leadership | `/lead` | 2 | 10 | Team health, OKRs, culture, hiring |
61
+ | Organization | `/org` | 1 | 10 | Org design, team topologies |
62
+ | **Quality Gate** | (auto) | 3 | — | Mandatory on every workflow. Veto power. |
61
63
 
62
64
  ## How It Works
63
65
 
64
66
  **Just describe what you need.** ArkaOS routes it to the right squad.
65
67
 
66
68
  ```
67
- "add user authentication" → /dev feature
68
- "create a brand for my app" → /brand identity
69
- "plan our Q3 budget" → /fin budget
70
- "design a sales funnel" → /landing funnel
71
- "grow my Discord community" → /community grow
72
- "write viral hooks for TikTok"→ /content hook
69
+ "add user authentication" → /dev feature
70
+ "create a brand for my app" → /brand identity
71
+ "plan our Q3 budget" → /fin budget
72
+ "design a sales funnel" → /landing funnel
73
+ "are we GDPR compliant?" → /ops gdpr-compliance
74
+ "score these headlines" python scripts/tools/headline_scorer.py
73
75
  ```
74
76
 
75
- Or use explicit commands: `/dev feature "user auth"`, `/saas validate "scheduling tool"`, `/strat blue-ocean "AI tools market"`
77
+ Or use explicit commands: `/dev feature "user auth"`, `/saas validate "scheduling tool"`
78
+
79
+ ## Python CLI Tools
80
+
81
+ 8 stdlib-only tools for quantitative analysis. No dependencies.
82
+
83
+ ```bash
84
+ python scripts/tools/headline_scorer.py "10x Your Revenue" --json
85
+ python scripts/tools/seo_checker.py page.html --json
86
+ python scripts/tools/rice_prioritizer.py features.json --json
87
+ python scripts/tools/dcf_calculator.py --revenue 1000000 --growth 20 --json
88
+ python scripts/tools/tech_debt_analyzer.py src/ --json
89
+ python scripts/tools/saas_metrics.py --new-mrr 50000 --json
90
+ python scripts/tools/brand_voice_analyzer.py content.txt --json
91
+ python scripts/tools/okr_cascade.py growth --json
92
+ ```
76
93
 
77
94
  ## Agent DNA
78
95
 
79
- Every agent has a complete behavioral profile built from 4 frameworks:
96
+ Every agent has a behavioral profile from 4 frameworks:
80
97
 
81
- - **DISC** — How they communicate (Driver, Inspirer, Supporter, Analyst)
98
+ - **DISC** — How they communicate
82
99
  - **Enneagram** — What motivates them (9 types with wings)
83
- - **Big Five** — Personality traits on a 0-100 scale
84
- - **MBTI** — How they process information (16 types, cognitive functions)
85
-
86
- This creates agents with consistent, realistic personalities that communicate differently based on their role and the situation.
100
+ - **Big Five** — Personality traits (0-100 scale)
101
+ - **MBTI** — How they process information
87
102
 
88
103
  ## Quality Gate
89
104
 
90
- Nothing reaches you without approval from all three reviewers:
105
+ Nothing reaches you without all three reviewers:
106
+
107
+ - **Marta** (CQO) — orchestrates and issues final verdict
108
+ - **Eduardo** — text quality: spelling, grammar, tone, AI patterns
109
+ - **Francisca** — technical quality: code, tests, UX, security
91
110
 
92
- - **Marta** (CQO) orchestrates the review and issues the final verdict
93
- - **Eduardo** reviews all text: spelling, grammar, tone, AI patterns
94
- - **Francisca** reviews all technical output: code quality, tests, UX, security
111
+ APPROVED or REJECTED. No exceptions.
95
112
 
96
- Binary verdict: APPROVED or REJECTED. No exceptions. No soft approvals.
113
+ ## The Conclave
114
+
115
+ Personal AI advisory board with 20 real-world advisor personas (Munger, Dalio, Bezos, Naval, Jobs, Sinek, etc.). Matched to your behavioral DNA via 17-question profiling.
116
+
117
+ ```
118
+ /arka conclave # Start profiling
119
+ /arka conclave ask # Ask all advisors
120
+ /arka conclave debate # Advisors debate a topic
121
+ ```
97
122
 
98
123
  ## Enterprise Frameworks
99
124
 
100
- ArkaOS agents don't improvise. They apply validated frameworks:
125
+ ArkaOS agents apply validated frameworks, not generic prompts:
101
126
 
102
127
  | Area | Frameworks |
103
128
  |------|-----------|
104
- | Development | Clean Code, SOLID, DDD, TDD, DORA Metrics, OWASP Top 10 |
129
+ | Development | Clean Code, SOLID, DDD, TDD, DORA, OWASP, MITRE ATT&CK |
105
130
  | Branding | Primal Branding, StoryBrand, 12 Archetypes, Positioning |
106
131
  | Strategy | Porter's Five Forces, Blue Ocean, BMC, Wardley Maps, 7 Powers |
107
- | Finance | DCF Valuation, Unit Economics, COSO ERM, FP&A, Venture Deals |
132
+ | Finance | DCF Valuation, Unit Economics, COSO ERM, ALE Risk Quantification |
108
133
  | Marketing | AARRR, Growth Loops, Schwartz 5 Levels, PLG, STEPPS |
109
- | GTM/Launch | Hormozi Grand Slam, Value Ladder, PLF, Crossing the Chasm |
110
- | Organization | Team Topologies, Five Dysfunctions, OKRs, Netflix Culture |
111
- | PM | Scrum, Kanban, Shape Up, Continuous Discovery, Monte Carlo |
134
+ | Compliance | GDPR, ISO 27001, SOC 2, ISO 31000, ISO 9001 |
135
+ | PM | Scrum, Kanban, Shape Up, Continuous Discovery, RICE |
112
136
 
113
137
  ## Multi-Runtime
114
138
 
115
- ArkaOS works with any AI coding tool:
116
-
117
- | Runtime | Status | Features |
118
- |---------|--------|----------|
119
- | Claude Code | Primary | Hooks, subagents, MCP, 1M context |
120
- | Codex CLI | Supported | Subagents, sandboxed execution |
121
- | Gemini CLI | Supported | Subagents, MCP, 1M context |
122
- | Cursor | Supported | Agent mode, MCP |
139
+ | Runtime | Status |
140
+ |---------|--------|
141
+ | Claude Code | Primary hooks, subagents, MCP, 1M context |
142
+ | Codex CLI | Supported — subagents, sandboxed execution |
143
+ | Gemini CLI | Supported subagents, MCP, 1M context |
144
+ | Cursor | Supported agent mode, MCP |
123
145
 
124
146
  ## Architecture
125
147
 
126
148
  ```
127
149
  User Input
128
150
 
129
- Synapse (8-layer context injection, <1ms)
151
+ Synapse (8-layer context injection)
130
152
 
131
153
  Orchestrator (/do → department routing)
132
154
 
@@ -134,21 +156,25 @@ Squad (YAML workflow with phases and gates)
134
156
 
135
157
  Quality Gate (Marta + Eduardo + Francisca)
136
158
 
137
- Obsidian (all output saved to vault)
159
+ Output (Obsidian vault + structured deliverables)
138
160
  ```
139
161
 
140
- Built with: Python core engine, Node.js installer, Bash hooks, YAML workflows.
162
+ Built with: Python core engine, Node.js installer, Bash hooks, YAML workflows, 1688 tests.
141
163
 
142
- ## Community & Pro
164
+ ## Commands
143
165
 
144
- **Community Edition** (this repo): 56 agents, 16 departments, ~216 commands, full workflow engine.
166
+ ```bash
167
+ npx arkaos install # Install
168
+ npx arkaos update # Update to latest
169
+ npx arkaos migrate # Migrate from v1
170
+ npx arkaos doctor # Health check
171
+ npx arkaos uninstall # Remove
172
+ ```
145
173
 
146
- **Pro** (coming soon): Additional agents, premium skills, knowledge packs, priority support.
174
+ ## Contributing
147
175
 
148
- ## License
176
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md). PRs welcome — all changes require review.
149
177
 
150
- MIT
151
-
152
- ---
178
+ ## License
153
179
 
154
- **ArkaOS** — WizardingCode
180
+ MIT[WizardingCode](https://wizardingcode.com)
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
package/bin/arkaos CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  set -euo pipefail
8
8
 
9
- VERSION="2.0.0-alpha.1"
9
+ VERSION=$(node -p "require('$(dirname "$(readlink -f "$0")")/../package.json').version" 2>/dev/null || echo "2.0.0")
10
10
  INSTALL_DIR="${HOME}/.arkaos"
11
11
  REPO_ROOT=""
12
12
 
@@ -125,3 +125,7 @@ Surface these issues WITHOUT being asked:
125
125
  - Latency budget: <Xms per stage>
126
126
  - Cost ceiling: <$ per task>
127
127
  ```
128
+
129
+ ## References
130
+
131
+ - [architecture-patterns.md](references/architecture-patterns.md) — 5 multi-agent patterns with decision matrix, anti-patterns, and scaling characteristics
@@ -0,0 +1,223 @@
1
+ # Multi-Agent Architecture Patterns — Deep Reference
2
+
3
+ > 5 patterns with decision criteria, anti-patterns, scaling characteristics, and failure modes.
4
+
5
+ ## Pattern Decision Matrix
6
+
7
+ | Criterion | Single | Supervisor | Swarm | Hierarchical | Pipeline |
8
+ |-----------|--------|-----------|-------|-------------|----------|
9
+ | Task complexity | Low | Medium | High (emergent) | High (structured) | Medium (sequential) |
10
+ | Agents needed | 1 | 2-10 | 5-50+ | 10-100+ | 3-10 |
11
+ | Coordination overhead | None | Low | High | Medium | Low |
12
+ | Fault tolerance | None | Supervisor is SPOF | High | Medium | Low (chain breaks) |
13
+ | Debuggability | Easy | Medium | Hard | Medium | Easy |
14
+ | Latency | Lowest | Medium | Variable | Higher | Sum of stages |
15
+
16
+ ## Pattern 1: Single Agent
17
+
18
+ **Structure:** One agent handles all tasks end-to-end.
19
+
20
+ ```
21
+ User --> [Agent] --> Result
22
+ |
23
+ [Tool 1] [Tool 2] [Tool 3]
24
+ ```
25
+
26
+ **When to use:**
27
+ - Task scope is narrow and well-defined
28
+ - Fewer than 5 tools needed
29
+ - No parallelism benefit
30
+ - Latency is critical
31
+
32
+ **Real-world examples:** Code review bot, customer FAQ responder, log summarizer.
33
+
34
+ **Anti-patterns:**
35
+ - Agent has 10+ tools (cognitive overload, poor tool selection)
36
+ - Agent handles both planning and execution (conflated responsibilities)
37
+ - Agent needs expertise in multiple unrelated domains
38
+
39
+ **Scaling limit:** Degrades when context window fills or tool count exceeds 5-7.
40
+
41
+ **Failure modes:**
42
+
43
+ | Failure | Symptom | Mitigation |
44
+ |---------|---------|------------|
45
+ | Context overflow | Truncated reasoning, lost instructions | Summarize intermediate results |
46
+ | Tool selection errors | Wrong tool called | Reduce tool count, improve descriptions |
47
+ | Single point of failure | Total task failure | Retry with backoff |
48
+
49
+ ## Pattern 2: Supervisor (Hub-and-Spoke)
50
+
51
+ **Structure:** One coordinator delegates to specialized workers.
52
+
53
+ ```
54
+ User --> [Supervisor]
55
+ |
56
+ +-------+-------+
57
+ | | |
58
+ [Worker] [Worker] [Worker]
59
+ ```
60
+
61
+ **When to use:**
62
+ - Tasks decompose into independent subtasks
63
+ - Need centralized quality control
64
+ - Workers have distinct specializations
65
+ - 2-10 workers
66
+
67
+ **Real-world examples:** ArkaOS department leads, customer support routing, document processing with specialists (OCR agent, NLP agent, validation agent).
68
+
69
+ **Anti-patterns:**
70
+ - Supervisor does work instead of delegating (bottleneck)
71
+ - Workers communicate directly bypassing supervisor (untracked state)
72
+ - Single supervisor for 20+ workers (coordination overload)
73
+
74
+ **Scaling:** Linear with worker count until supervisor becomes bottleneck (~10-15 workers). Fix with hierarchical pattern.
75
+
76
+ **Failure modes:**
77
+
78
+ | Failure | Symptom | Mitigation |
79
+ |---------|---------|------------|
80
+ | Supervisor bottleneck | High latency, queued tasks | Add worker-level autonomy |
81
+ | Bad task decomposition | Workers receive incomplete context | Structured handoff schema |
82
+ | Worker failure | Subtask missing from result | Retry policy, fallback workers |
83
+
84
+ ## Pattern 3: Swarm (Peer-to-Peer)
85
+
86
+ **Structure:** Agents communicate directly, no central coordinator.
87
+
88
+ ```
89
+ [Agent A] <---> [Agent B]
90
+ ^ ^
91
+ | |
92
+ v v
93
+ [Agent C] <---> [Agent D]
94
+ ```
95
+
96
+ **When to use:**
97
+ - Problems require emergent solutions
98
+ - No single agent can plan the full solution
99
+ - High parallelism needed
100
+ - Fault tolerance is critical (no SPOF)
101
+
102
+ **Real-world examples:** Distributed code review (each agent reviews different aspects), brainstorming systems, adversarial debate architectures.
103
+
104
+ **Anti-patterns:**
105
+ - No termination condition (infinite loops)
106
+ - No shared state schema (agents talk past each other)
107
+ - All agents have identical capabilities (no specialization benefit)
108
+ - No conflict resolution mechanism (contradictory outputs)
109
+
110
+ **Scaling:** Scales well horizontally but communication complexity grows O(n^2). Use topic-based pub/sub to reduce.
111
+
112
+ **Failure modes:**
113
+
114
+ | Failure | Symptom | Mitigation |
115
+ |---------|---------|------------|
116
+ | Infinite loops | Never-ending agent conversations | Max iteration count, convergence check |
117
+ | State divergence | Agents working on stale information | Shared state with version vectors |
118
+ | Deadlock | Agents waiting on each other | Timeout-based resolution |
119
+ | Emergent chaos | Unpredictable outputs | Guardrails on each agent, output validation |
120
+
121
+ ## Pattern 4: Hierarchical (Tree)
122
+
123
+ **Structure:** Multiple levels of supervisors forming an organizational tree.
124
+
125
+ ```
126
+ [Executive]
127
+ / \
128
+ [Manager A] [Manager B]
129
+ / \ / \
130
+ [W1] [W2] [W3] [W4]
131
+ ```
132
+
133
+ **When to use:**
134
+ - Large-scale systems with 10+ agents
135
+ - Natural organizational decomposition (departments, teams)
136
+ - Different abstraction levels needed (strategy vs execution)
137
+ - Need both autonomy and oversight
138
+
139
+ **Real-world examples:** ArkaOS full system (CTO > Leads > Specialists), enterprise workflow automation, large codebase refactoring.
140
+
141
+ **Anti-patterns:**
142
+ - Too many hierarchy levels (>3 for most systems, latency compounds)
143
+ - Managers that just pass messages (no value-add at each level)
144
+ - No skip-level communication for urgent issues
145
+ - Rigid hierarchy when tasks cross organizational boundaries
146
+
147
+ **Scaling:** Best for large systems. Add branches, not depth. Keep depth at 2-3 levels maximum.
148
+
149
+ **Failure modes:**
150
+
151
+ | Failure | Symptom | Mitigation |
152
+ |---------|---------|------------|
153
+ | Communication overhead | Slow responses, garbled context | Structured handoff contracts |
154
+ | Middle management bloat | Layers that add latency without value | Audit each level's contribution |
155
+ | Cross-branch coordination | Tasks that need agents from different branches | Ad-hoc squads, matrix overlay |
156
+ | Cascade failure | Manager failure kills entire branch | Fallback managers, worker autonomy |
157
+
158
+ ## Pattern 5: Pipeline (Sequential Chain)
159
+
160
+ **Structure:** Agents process data in a fixed sequence.
161
+
162
+ ```
163
+ [Input] --> [Stage 1] --> [Stage 2] --> [Stage 3] --> [Output]
164
+ Extract Transform Validate
165
+ ```
166
+
167
+ **When to use:**
168
+ - Processing has a natural sequential order
169
+ - Each stage has a clear input/output contract
170
+ - Stages are independently testable
171
+ - Data transformation workflows
172
+
173
+ **Real-world examples:** RAG pipeline (chunk > embed > retrieve > rerank > generate), CI/CD pipeline, content moderation (detect > classify > action).
174
+
175
+ **Anti-patterns:**
176
+ - Stage needs output from a non-adjacent stage (breaks linearity)
177
+ - Stages are tightly coupled (can not test independently)
178
+ - No error handling between stages (silent failures propagate)
179
+ - Pipeline too long (>7 stages, latency compounds)
180
+
181
+ **Scaling:** Scale individual stages independently. Bottleneck is the slowest stage. Use queues between stages for buffering.
182
+
183
+ **Failure modes:**
184
+
185
+ | Failure | Symptom | Mitigation |
186
+ |---------|---------|------------|
187
+ | Stage failure | Pipeline halts | Dead letter queue, skip with default |
188
+ | Bottleneck stage | Throughput limited by slowest stage | Scale that stage, add parallelism |
189
+ | Schema mismatch | Stage receives unexpected input format | Strict contracts, validation between stages |
190
+ | Error propagation | Bad output from stage N corrupts N+1 | Validation gates between stages |
191
+
192
+ ## Pattern Selection Checklist
193
+
194
+ Use this checklist to narrow down the right pattern:
195
+
196
+ - [ ] How many distinct agent roles are needed? (1 = Single, 2-10 = Supervisor, 10+ = Hierarchical)
197
+ - [ ] Is the workflow sequential or parallel? (Sequential = Pipeline, Parallel = Supervisor/Swarm)
198
+ - [ ] Is there a natural coordinator? (Yes = Supervisor, No = Swarm)
199
+ - [ ] How important is fault tolerance? (Critical = Swarm, Standard = Supervisor)
200
+ - [ ] What is the latency budget? (Tight = Single/Pipeline, Flexible = Hierarchical)
201
+ - [ ] How debuggable must the system be? (High = Pipeline/Single, Medium = Supervisor)
202
+
203
+ ## Hybrid Patterns
204
+
205
+ Most production systems combine patterns:
206
+
207
+ | Hybrid | Structure | Example |
208
+ |--------|-----------|---------|
209
+ | **Supervisor + Pipeline** | Supervisor delegates to pipelines | ArkaOS workflow phases |
210
+ | **Hierarchical + Swarm** | Tree structure with peer collaboration at leaf level | Department leads + specialist brainstorming |
211
+ | **Pipeline + Supervisor** | Pipeline stages contain supervisor-worker teams | ETL where transform stage has multiple workers |
212
+
213
+ ## Token Handoff Cost
214
+
215
+ | Pattern | Tokens per Handoff | Handoffs per Task | Total Overhead |
216
+ |---------|-------------------|-------------------|----------------|
217
+ | Single | 0 | 0 | 0 |
218
+ | Supervisor | 200-500 | 2-5 | 400-2500 |
219
+ | Pipeline | 300-800 | N stages | 300N-800N |
220
+ | Hierarchical | 200-500 | 2-3 per level | 400-1500 per level |
221
+ | Swarm | 100-300 | Unpredictable | High variance |
222
+
223
+ Rule of thumb: If total handoff overhead exceeds 30% of useful work tokens, simplify the architecture.
@@ -110,3 +110,7 @@ Surface these issues WITHOUT being asked:
110
110
  | Priority | Action | Effort | Risk Reduced |
111
111
  |----------|--------|--------|-------------|
112
112
  ```
113
+
114
+ ## References
115
+
116
+ - [prompt-injection-catalog.md](references/prompt-injection-catalog.md) — Direct and indirect injection attacks, jailbreaks, data exfiltration via tools, detection patterns, and mitigation strategies