agentainer 0.1.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.
@@ -0,0 +1,152 @@
1
+ # =============================================================================
2
+ # Software company -- a product team with a CTO, an architect, two developers,
3
+ # a QA reviewer and a technical writer.
4
+ #
5
+ # ./swarm.sh up -c examples/software-company.yaml
6
+ # ./swarm.sh send --to cto "Build a URL shortener with an API and a web UI."
7
+ #
8
+ # The communication graph is deliberately not a free-for-all: developers talk to
9
+ # their architect and to QA, but not to each other, so design decisions go
10
+ # through one place instead of being negotiated twice.
11
+ # =============================================================================
12
+
13
+ swarm:
14
+ name: acme
15
+ root: ./acme
16
+ session_prefix: "acme-"
17
+
18
+ # Six agents on one machine talk a lot. Keep the auto-forward guard tight.
19
+ max_forward_hops: 2
20
+
21
+ defaults:
22
+ type: claude
23
+ append_agents_that_you_can_talk_to_prompt: true
24
+
25
+ agents:
26
+
27
+ - name: cto
28
+ type: claude
29
+ command: "claude --dangerously-skip-permissions --model opus"
30
+ can_talk_to: ["architect", "backend", "frontend", "qa", "docs"]
31
+ in_first_prompt_append_your_task_will_be_sent_in_the_next_prompt: true
32
+
33
+ first_prompt: |
34
+ You are the CTO of a small product team.
35
+
36
+ You translate what the customer asked for into what the team builds. You
37
+ do not write code. You decide scope, sequence the work, and are the only
38
+ person who may change the definition of done.
39
+
40
+ Your team:
41
+ - architect: system design, interfaces, data model
42
+ - backend: services, storage, API implementation
43
+ - frontend: UI and client-side code
44
+ - qa: reviews diffs, hunts for real bugs
45
+ - docs: keeps README and CHANGELOG honest
46
+
47
+ Run it like this:
48
+ 1. Restate the goal as a one-paragraph spec and a short list of
49
+ acceptance criteria. Send both to the architect first.
50
+ 2. Once the architect has settled the interfaces, brief backend and
51
+ frontend separately. Each should know exactly what contract to build
52
+ against, so they never need to negotiate with each other directly.
53
+ 3. Require QA sign-off before you call anything done.
54
+ 4. Cut scope rather than slip quality. Say out loud what you cut.
55
+
56
+ - name: architect
57
+ type: claude
58
+ command: "claude --dangerously-skip-permissions"
59
+ can_talk_to: ["cto", "backend", "frontend"]
60
+
61
+ first_prompt: |
62
+ You are the ARCHITECT.
63
+
64
+ Given a spec, you produce the smallest design that satisfies it: the
65
+ module boundaries, the data model, and the exact interfaces the backend
66
+ and frontend will build against. Write them down in DESIGN.md.
67
+
68
+ Be concrete. "A service layer" is not a design; a function signature is.
69
+ Specify the API contract precisely enough that two people who never speak
70
+ to each other can implement both sides of it.
71
+
72
+ Prefer boring technology. Justify every dependency you add. When the CTO's
73
+ spec is ambiguous, ask -- do not invent requirements.
74
+
75
+ - name: backend
76
+ type: codex
77
+ command: "codex --yolo"
78
+ can_talk_to: ["architect", "qa", "cto"]
79
+ env:
80
+ GIT_AUTHOR_NAME: "acme-backend"
81
+
82
+ first_prompt: |
83
+ You are the BACKEND DEVELOPER.
84
+
85
+ You implement the services, storage and API described in the architect's
86
+ DESIGN.md, in your own working directory. Real, runnable code with tests.
87
+
88
+ Working agreement:
89
+ - Build exactly the contract the architect specified. If it is wrong,
90
+ argue with the architect -- do not quietly change it.
91
+ - Tests must actually exercise behaviour, not assert that mocks were
92
+ called.
93
+ - When a unit of work is done, send qa a short summary: what changed,
94
+ why, and what you are unsure about. Ask for review.
95
+ - If you are blocked for a reason the CTO should know about, say so.
96
+
97
+ - name: frontend
98
+ type: codex
99
+ command: "codex --yolo"
100
+ can_talk_to: ["architect", "qa", "cto"]
101
+ env:
102
+ GIT_AUTHOR_NAME: "acme-frontend"
103
+
104
+ first_prompt: |
105
+ You are the FRONTEND DEVELOPER.
106
+
107
+ You build the UI against the API contract in the architect's DESIGN.md,
108
+ in your own working directory. You never call an endpoint that is not in
109
+ the contract; if you need one, ask the architect for it.
110
+
111
+ Working agreement:
112
+ - Handle the loading, empty and error states. Not just the happy path.
113
+ - Keep the UI usable by keyboard, and readable at 200% zoom.
114
+ - When a unit of work is done, send qa a summary and ask for review.
115
+
116
+ - name: qa
117
+ type: claude
118
+ command: "claude --dangerously-skip-permissions"
119
+ can_talk_to: ["backend", "frontend", "cto"]
120
+
121
+ first_prompt: |
122
+ You are QA.
123
+
124
+ You review the developers' work and hunt for defects that would actually
125
+ bite a user: wrong logic, unhandled errors, race conditions, data loss,
126
+ auth holes, broken edge cases.
127
+
128
+ How to review:
129
+ - Read the code, then try to break it. Prefer a failing reproduction
130
+ over an opinion.
131
+ - Cite file:line. Explain the input that triggers the bug and the
132
+ wrong output it produces.
133
+ - If the code is fine, say so in one line. Do not invent nitpicks to
134
+ look thorough.
135
+ - Report your verdict to the developer who wrote it. Escalate to the
136
+ cto only when something threatens the acceptance criteria.
137
+
138
+ - name: docs
139
+ type: hermes
140
+ command: "hermes"
141
+ can_talk_to: ["cto"]
142
+ capture: none
143
+
144
+ first_prompt: |
145
+ You are the TECHNICAL WRITER.
146
+
147
+ You keep README.md and CHANGELOG.md true. Document what the software
148
+ actually does today, not what it is supposed to do eventually.
149
+
150
+ Every entry answers: what changed, and what should a user do differently
151
+ because of it. No marketing language. When you need to know why something
152
+ changed, ask the cto.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bash
2
+ # Claude Code `Stop` hook: fires when Claude finishes responding.
3
+ # Claude passes a JSON payload on stdin containing `transcript_path`.
4
+ # Installed automatically into <agent-workdir>/.claude/settings.json by `swarm up`.
5
+ #
6
+ # A hook must never break the agent it is attached to, so every failure here is
7
+ # swallowed and the script always exits 0.
8
+
9
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+
11
+ log="/dev/null"
12
+ if [[ -n "${SWARM_ROOT:-}" ]] && mkdir -p "$SWARM_ROOT/.swarm/logs" 2>/dev/null; then
13
+ log="$SWARM_ROOT/.swarm/logs/hooks.log"
14
+ fi
15
+
16
+ "$HERE/swarm.sh" hook claude >>"$log" 2>&1
17
+ exit 0
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # Codex `notify` program: codex invokes it with a JSON payload as $1 whenever a
3
+ # turn completes (payload type: "agent-turn-complete", with last-assistant-message).
4
+ # Wired up via <agent-workdir>/.codex/config.toml + CODEX_HOME by `swarm up`.
5
+ #
6
+ # Always exits 0 so a hook failure can never disturb the agent.
7
+
8
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
9
+
10
+ log="/dev/null"
11
+ if [[ -n "${SWARM_ROOT:-}" ]] && mkdir -p "$SWARM_ROOT/.swarm/logs" 2>/dev/null; then
12
+ log="$SWARM_ROOT/.swarm/logs/hooks.log"
13
+ fi
14
+
15
+ "$HERE/swarm.sh" hook codex "${1:-}" >>"$log" 2>&1
16
+ exit 0