@arka-labs/nemesis 1.2.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.
- package/LICENSE +201 -0
- package/README.md +668 -0
- package/lib/core/agent-launcher.js +193 -0
- package/lib/core/audit.js +210 -0
- package/lib/core/connexions.js +80 -0
- package/lib/core/flowmap/api.js +111 -0
- package/lib/core/flowmap/cli-helpers.js +80 -0
- package/lib/core/flowmap/machine.js +281 -0
- package/lib/core/flowmap/persistence.js +83 -0
- package/lib/core/generators.js +183 -0
- package/lib/core/inbox.js +275 -0
- package/lib/core/logger.js +20 -0
- package/lib/core/mission.js +109 -0
- package/lib/core/notewriter/config.js +36 -0
- package/lib/core/notewriter/cr.js +237 -0
- package/lib/core/notewriter/log.js +112 -0
- package/lib/core/notewriter/notes.js +168 -0
- package/lib/core/notewriter/paths.js +45 -0
- package/lib/core/notewriter/reader.js +121 -0
- package/lib/core/notewriter/registry.js +80 -0
- package/lib/core/odm.js +191 -0
- package/lib/core/profile-picker.js +323 -0
- package/lib/core/project.js +287 -0
- package/lib/core/registry.js +129 -0
- package/lib/core/secrets.js +137 -0
- package/lib/core/services.js +45 -0
- package/lib/core/team.js +287 -0
- package/lib/core/templates.js +80 -0
- package/lib/kairos/agent-runner.js +261 -0
- package/lib/kairos/claude-invoker.js +90 -0
- package/lib/kairos/context-injector.js +331 -0
- package/lib/kairos/context-loader.js +108 -0
- package/lib/kairos/context-writer.js +45 -0
- package/lib/kairos/dispatcher-router.js +173 -0
- package/lib/kairos/dispatcher.js +139 -0
- package/lib/kairos/event-bus.js +287 -0
- package/lib/kairos/event-router.js +131 -0
- package/lib/kairos/flowmap-bridge.js +120 -0
- package/lib/kairos/hook-handlers.js +351 -0
- package/lib/kairos/hook-installer.js +207 -0
- package/lib/kairos/hook-prompts.js +54 -0
- package/lib/kairos/leader-rules.js +94 -0
- package/lib/kairos/pid-checker.js +108 -0
- package/lib/kairos/situation-detector.js +123 -0
- package/lib/sync/fallback-engine.js +97 -0
- package/lib/sync/hcm-client.js +170 -0
- package/lib/sync/health.js +47 -0
- package/lib/sync/llm-client.js +387 -0
- package/lib/sync/nemesis-client.js +379 -0
- package/lib/sync/service-session.js +74 -0
- package/lib/sync/sync-engine.js +178 -0
- package/lib/ui/box.js +104 -0
- package/lib/ui/brand.js +42 -0
- package/lib/ui/colors.js +57 -0
- package/lib/ui/dashboard.js +580 -0
- package/lib/ui/error-hints.js +49 -0
- package/lib/ui/format.js +61 -0
- package/lib/ui/menu.js +306 -0
- package/lib/ui/note-card.js +198 -0
- package/lib/ui/note-colors.js +26 -0
- package/lib/ui/note-detail.js +297 -0
- package/lib/ui/note-filters.js +252 -0
- package/lib/ui/note-views.js +283 -0
- package/lib/ui/prompt.js +81 -0
- package/lib/ui/spinner.js +139 -0
- package/lib/ui/streambox.js +46 -0
- package/lib/ui/table.js +42 -0
- package/lib/ui/tree.js +33 -0
- package/package.json +53 -0
- package/src/cli.js +457 -0
- package/src/commands/_helpers.js +119 -0
- package/src/commands/audit.js +187 -0
- package/src/commands/auth.js +316 -0
- package/src/commands/doctor.js +243 -0
- package/src/commands/hcm.js +147 -0
- package/src/commands/inbox.js +333 -0
- package/src/commands/init.js +160 -0
- package/src/commands/kairos.js +216 -0
- package/src/commands/kars.js +134 -0
- package/src/commands/mission.js +275 -0
- package/src/commands/notes.js +316 -0
- package/src/commands/notewriter.js +296 -0
- package/src/commands/odm.js +329 -0
- package/src/commands/orch.js +68 -0
- package/src/commands/project.js +123 -0
- package/src/commands/run.js +123 -0
- package/src/commands/services.js +705 -0
- package/src/commands/status.js +231 -0
- package/src/commands/team.js +572 -0
- package/src/config.js +84 -0
- package/src/index.js +5 -0
- package/templates/project-context.json +10 -0
- package/templates/template_CONTRIB-NAME.json +22 -0
- package/templates/template_CR-ODM-NAME-000.exemple.json +32 -0
- package/templates/template_DEC-NAME-000.json +18 -0
- package/templates/template_INTV-NAME-000.json +15 -0
- package/templates/template_MISSION_CONTRACT.json +46 -0
- package/templates/template_ODM-NAME-000.json +89 -0
- package/templates/template_REGISTRY-PROJECT.json +26 -0
- package/templates/template_TXN-NAME-000.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<pre align="center">
|
|
3
|
+
█████╗ ██████╗ ██╗ ██╗ █████╗ ██╗ █████╗ ██████╗ ███████╗
|
|
4
|
+
██╔══██╗██╔══██╗██║ ██╔╝██╔══██╗██║ ██╔══██╗██╔══██╗██╔════╝
|
|
5
|
+
███████║██████╔╝█████╔╝ ███████║██║ ███████║██████╔╝███████╗
|
|
6
|
+
██╔══██║██╔══██╗██╔═██╗ ██╔══██║██║ ██╔══██║██╔══██╗╚════██║
|
|
7
|
+
██║ ██║██║ ██║██║ ██╗██║ ██║███████╗██║ ██║██████╔╝███████║
|
|
8
|
+
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝
|
|
9
|
+
</pre>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<h1 align="center">Nemesis CLI</h1>
|
|
13
|
+
<p align="center"><strong>PM cockpit for orchestrating AI agent teams</strong></p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/@arka-labs/nemesis"><img src="https://img.shields.io/npm/v/@arka-labs/nemesis.svg" alt="npm version"></a>
|
|
17
|
+
<img src="https://img.shields.io/node/v/@arka-labs/nemesis.svg" alt="node version">
|
|
18
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="license"></a>
|
|
19
|
+
<img src="https://img.shields.io/badge/dependencies-1_(xstate)-blue.svg" alt="dependencies">
|
|
20
|
+
<img src="https://img.shields.io/badge/tests-862%20passing-brightgreen.svg" alt="tests">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Why Nemesis?
|
|
26
|
+
|
|
27
|
+
When you orchestrate a team of AI agents (Claude Code, Copilot, etc.), you need structure: who does what, what's been assigned, what's been delivered, what's broken. Nemesis gives you a **file-first CLI cockpit** to manage all of that without a server, a database, or any runtime dependency. JSON files in your repo are the single source of truth. A remote HCM (Human Capital Management) graph keeps everything in sync.
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Install globally
|
|
33
|
+
npm install -g @arka-labs/nemesis
|
|
34
|
+
|
|
35
|
+
# Initialize a project in your repo
|
|
36
|
+
nemesis init
|
|
37
|
+
|
|
38
|
+
# Add an AI agent to your team
|
|
39
|
+
nemesis team add
|
|
40
|
+
|
|
41
|
+
# Check project status
|
|
42
|
+
nemesis status
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Requires **Node.js >= 20**. Single runtime dependency (xstate for workflow state machine).
|
|
46
|
+
|
|
47
|
+
## Interactive Mode
|
|
48
|
+
|
|
49
|
+
Run `nemesis` without arguments to launch the interactive menu:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
█████╗ ██████╗ ██╗ ██╗ █████╗ ██╗ █████╗ ██████╗ ███████╗
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
ARKA Labs CLI v1.2.0 nemesis
|
|
56
|
+
|
|
57
|
+
── Projet ──────────────────────────
|
|
58
|
+
❯ status — Etat du projet + alertes
|
|
59
|
+
init — Scaffold structure projet
|
|
60
|
+
doctor — Diagnostic complet
|
|
61
|
+
|
|
62
|
+
── Equipe ──────────────────────────
|
|
63
|
+
team:list — Organigramme hierarchique
|
|
64
|
+
team:panneau— Panneau agent
|
|
65
|
+
team:add — Ajouter un agent
|
|
66
|
+
kars — Profils Kairos disponibles
|
|
67
|
+
|
|
68
|
+
── Travail ─────────────────────────
|
|
69
|
+
orch — Dashboard orchestration
|
|
70
|
+
inbox — Documents → Mission Contract
|
|
71
|
+
mission — Mission Contracts
|
|
72
|
+
odm — Ordres de Mission
|
|
73
|
+
audit — Audits techniques
|
|
74
|
+
|
|
75
|
+
── Memoire ─────────────────────────
|
|
76
|
+
notes — Notes et CRs agents
|
|
77
|
+
notewriter — Gestion contexte agent
|
|
78
|
+
|
|
79
|
+
── Infra ───────────────────────────
|
|
80
|
+
services — Connexions LLM
|
|
81
|
+
hcm — Synchronisation HCM
|
|
82
|
+
auth — Login HCM
|
|
83
|
+
kairos — Hooks & contexte agent
|
|
84
|
+
|
|
85
|
+
Fleches ↑↓ pour naviguer, Enter pour selectionner, q pour quitter
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Navigate with arrow keys (or `j`/`k`), press Enter to select, `q` or Escape to quit.
|
|
89
|
+
|
|
90
|
+
## Commands
|
|
91
|
+
|
|
92
|
+
### `nemesis init`
|
|
93
|
+
|
|
94
|
+
Scaffold a new project structure in the current repository.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
nemesis init
|
|
98
|
+
nemesis init --bare --id MY-PROJECT --name "My Project" --desc "Description"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Creates:
|
|
102
|
+
- `.nemesis/HCM/` — 10 subdirectories for project artifacts (contracts, odm, cr, decisions, etc.)
|
|
103
|
+
- `.nemesis/template/` — 8 JSON templates for structured documents
|
|
104
|
+
- `CONTEXT_PROJECT_*.json` — project context file
|
|
105
|
+
- `REGISTRY-*.json` — team registry (PM only at start)
|
|
106
|
+
- `PROCESS.md` — workflow documentation
|
|
107
|
+
|
|
108
|
+
### `nemesis team`
|
|
109
|
+
|
|
110
|
+
The core command. Manages your AI agent team.
|
|
111
|
+
|
|
112
|
+
#### `nemesis team add`
|
|
113
|
+
|
|
114
|
+
Onboard a new agent through an interactive 9-step process:
|
|
115
|
+
|
|
116
|
+
1. Detect project
|
|
117
|
+
2. Select Kairos profile from HCM (or manual entry)
|
|
118
|
+
3. Configure agent (name, role, hierarchy)
|
|
119
|
+
4. Create `memory.md` for the agent
|
|
120
|
+
5. Create contributor card in `.nemesis/HCM/contributors/`
|
|
121
|
+
6. Update team registry
|
|
122
|
+
7. Update `~/.claude/CLAUDE.md` (agent table + workflow tree)
|
|
123
|
+
8. Generate onboarding prompt
|
|
124
|
+
9. Return launch command
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Interactive (recommended)
|
|
128
|
+
nemesis team add
|
|
129
|
+
|
|
130
|
+
# Non-interactive
|
|
131
|
+
nemesis team add --name Agent_Dev --role Implementeur --reports-to PM --no-prompt
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Output:
|
|
135
|
+
```
|
|
136
|
+
✓ Projet detecte → MY-PROJECT
|
|
137
|
+
✓ Agent configure → Agent_Dev — Implementeur
|
|
138
|
+
✓ memory.md cree → .nemesis/claude/Agent_Dev/memory.md
|
|
139
|
+
✓ Contributor card creee → .nemesis/HCM/contributors/CONTRIB-Dev.json
|
|
140
|
+
✓ Registre mis a jour → Lane ajoutee : Agent_Dev
|
|
141
|
+
✓ CLAUDE.md mis a jour → Tableau + Workflow
|
|
142
|
+
✓ Prompt d'onboarding genere → .nemesis/onboarding/prompt-Dev.md
|
|
143
|
+
✓ Commande de lancement → claude --prompt .nemesis/onboarding/prompt-Dev.md
|
|
144
|
+
|
|
145
|
+
Pour demarrer l'agent :
|
|
146
|
+
claude --prompt .nemesis/onboarding/prompt-Dev.md
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### `nemesis team list`
|
|
150
|
+
|
|
151
|
+
Display the organizational tree.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
nemesis team list
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
Jeremy Grimonpont (PM)
|
|
159
|
+
├── Agent_Nemesis-CLI (Architecte / QA)
|
|
160
|
+
│ └── Agent_Bot-CLI (Implementeur)
|
|
161
|
+
└── Agent_ARCH-CLI (Archiviste documentaire)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### `nemesis team inspect [agent]`
|
|
165
|
+
|
|
166
|
+
Detailed view of a specific agent: memory stats, assigned OdMs, recent CRs.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
nemesis team inspect Agent_Bot-CLI
|
|
170
|
+
nemesis team inspect Agent_Bot-CLI --format json
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Agent : Agent_Bot-CLI
|
|
175
|
+
Kind : agent
|
|
176
|
+
Role : Implementeur
|
|
177
|
+
Reporte a : Agent_Nemesis-CLI
|
|
178
|
+
MCP : (aucun)
|
|
179
|
+
Memory : .nemesis/claude/Agent_Bot-CLI/memory.md (2.1 KB, maj 2026-03-10)
|
|
180
|
+
|
|
181
|
+
OdMs assignes :
|
|
182
|
+
┌──────────────────┬──────────┬─────────────────────────────┐
|
|
183
|
+
│ OdM │ Status │ Titre │
|
|
184
|
+
├──────────────────┼──────────┼─────────────────────────────┤
|
|
185
|
+
│ ODM-NEMESIS-004 │ VALIDE │ Infrastructure + Team │
|
|
186
|
+
└──────────────────┴──────────┴─────────────────────────────┘
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### `nemesis team remove [agent]`
|
|
190
|
+
|
|
191
|
+
Archive an agent. Files are preserved for traceability (memory.md renamed to .archived).
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
nemesis team remove Agent_Dev
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### `nemesis project`
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
nemesis project status # Synthetic project view: team size, OdMs, decisions, CRs
|
|
201
|
+
nemesis project init # Alias for "nemesis init"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### `nemesis mission`
|
|
205
|
+
|
|
206
|
+
Manage Mission Contracts (high-level work packages with gates and task registries).
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
nemesis mission init # Create a new Mission Contract (auto-generates ID)
|
|
210
|
+
nemesis mission init MCT-001 # Create with explicit ID
|
|
211
|
+
nemesis mission list # List all contracts
|
|
212
|
+
nemesis mission inspect MCT-001 # Full contract content: cadrage, workflow, tasks
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### `nemesis odm`
|
|
216
|
+
|
|
217
|
+
Manage Ordres de Mission (specific, assignable work items derived from Mission Contracts).
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
nemesis odm init # Create a new OdM (auto-generates ID)
|
|
221
|
+
nemesis odm init ODM-004 # Create with explicit ID
|
|
222
|
+
nemesis odm list # List all OdMs with status/assignee/priority
|
|
223
|
+
nemesis odm inspect ODM-004 # Full OdM content + associated CRs
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### `nemesis status`
|
|
227
|
+
|
|
228
|
+
Quick project status with smart alerts.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
nemesis status
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
MY-PROJECT — 2 agent(s), 3 OdM, 1 en cours
|
|
236
|
+
|
|
237
|
+
⚠ Equipe vide — ajoutez un agent : nemesis team add
|
|
238
|
+
⚠ ODM-003 en DRAFT mais non assigne
|
|
239
|
+
⚠ Agent_Bot n'a pas mis a jour sa memoire depuis 4 jours
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Alerts include: empty team, missing Mission Contracts, OdMs without CRs, stale agent memory, unassigned drafts.
|
|
243
|
+
|
|
244
|
+
### `nemesis hcm`
|
|
245
|
+
|
|
246
|
+
Synchronize local JSON files with the remote HCM knowledge graph.
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
nemesis hcm status # Connection diagnostic (ping, auth, graph stats)
|
|
250
|
+
nemesis hcm sync # Scan .nemesis/HCM/, diff hashes, push modified files
|
|
251
|
+
nemesis hcm search "query" # Full-text search in HCM documents
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The sync engine:
|
|
255
|
+
1. Scans `.nemesis/HCM/` recursively for JSON files
|
|
256
|
+
2. Computes SHA-256 hashes and compares with last sync state
|
|
257
|
+
3. Pushes only modified files to the HCM API
|
|
258
|
+
4. Ignores `template_*` and `legacy_*` files
|
|
259
|
+
|
|
260
|
+
### `nemesis doctor`
|
|
261
|
+
|
|
262
|
+
Full system diagnostic.
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
nemesis doctor
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
Structure .nemesis/HCM/ :
|
|
270
|
+
✓ contracts/
|
|
271
|
+
✓ odm/
|
|
272
|
+
✓ cr/
|
|
273
|
+
...
|
|
274
|
+
|
|
275
|
+
Templates .nemesis/template/ :
|
|
276
|
+
✓ 8 templates presents
|
|
277
|
+
|
|
278
|
+
Config :
|
|
279
|
+
✓ Projet detecte : MY-PROJECT
|
|
280
|
+
|
|
281
|
+
HCM :
|
|
282
|
+
✓ Connexion : 142ms
|
|
283
|
+
✓ Auth : API key valide
|
|
284
|
+
✓ Graphe : 847 noeuds, 1203 edges
|
|
285
|
+
|
|
286
|
+
Registre :
|
|
287
|
+
✓ REGISTRY (3 membres)
|
|
288
|
+
✓ CLAUDE.md sync (2 agents)
|
|
289
|
+
|
|
290
|
+
Agents :
|
|
291
|
+
✓ Agent_Nemesis-CLI : memory.md present (3.2 KB)
|
|
292
|
+
✓ Agent_Bot-CLI : memory.md present (1.8 KB)
|
|
293
|
+
|
|
294
|
+
Tout est OK.
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Checks: directory structure (10 dirs), templates (8 files), config file, HCM connection (ping, auth, graph), registry vs CLAUDE.md sync, agent memory files.
|
|
298
|
+
|
|
299
|
+
### `nemesis orch`
|
|
300
|
+
|
|
301
|
+
Orchestration dashboard — monitor dispatches, escalations, and deliveries in real-time.
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
nemesis orch # Auto-refresh every 2s, quit with 'q'
|
|
305
|
+
nemesis orch --once # Display once and exit
|
|
306
|
+
nemesis orch --format json
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
The daemon polls for OdMs with status `READY_TO_DISPATCH`, auto-dispatches via headless agents, and routes results through the configured routing chain.
|
|
310
|
+
|
|
311
|
+
### `nemesis services`
|
|
312
|
+
|
|
313
|
+
Manage LLM provider connections and hook lifecycle.
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Connexions
|
|
317
|
+
nemesis services connexions add # Add provider (Anthropic, OpenAI, Gemini, Ollama, etc.)
|
|
318
|
+
nemesis services connexions list # List all connections with status
|
|
319
|
+
nemesis services connexions test # Health check (auth/endpoint)
|
|
320
|
+
nemesis services connexions live # Full validation (real LLM call + file I/O)
|
|
321
|
+
|
|
322
|
+
# Service assignment
|
|
323
|
+
nemesis services config # Assign connections to services (notes, odm, mc)
|
|
324
|
+
nemesis services status # Overview of all assignments + fallback chains
|
|
325
|
+
|
|
326
|
+
# Hooks
|
|
327
|
+
nemesis services hooks status # Hook state (active/inactive count)
|
|
328
|
+
nemesis services hooks setup # Enable all hooks
|
|
329
|
+
nemesis services hooks reset # Disable all hooks
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### `nemesis notes`
|
|
333
|
+
|
|
334
|
+
Browse agent notes and CRs with filtering and timeline views.
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
nemesis notes # Interactive menu
|
|
338
|
+
nemesis notes agent Agent_Dev # View by agent
|
|
339
|
+
nemesis notes timeline # Project timeline (all agents)
|
|
340
|
+
nemesis notes inspect NOTE-Dev-042 # Display note or CR by ID
|
|
341
|
+
nemesis notes agent Agent_Dev --cr # Filter CRs only
|
|
342
|
+
nemesis notes agent Agent_Dev --level L3 # Filter by level
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### `nemesis notewriter`
|
|
346
|
+
|
|
347
|
+
Manage agent context: notes, CRs, and session replay.
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
nemesis notewriter status Agent_Dev # NoteWriter state
|
|
351
|
+
nemesis notewriter cr Agent_Dev # Generate manual CR (calls LLM)
|
|
352
|
+
nemesis notewriter list Agent_Dev # List notes and CRs
|
|
353
|
+
nemesis notewriter inspect Agent_Dev NOTE-Dev-042
|
|
354
|
+
nemesis notewriter replay Agent_Dev # Replay session from JSONL log
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### `nemesis kairos`
|
|
358
|
+
|
|
359
|
+
Install and manage Claude Code hooks for agent context injection.
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
nemesis kairos hooks setup # Install 4 hooks into .claude/settings.json
|
|
363
|
+
nemesis kairos hooks status # Verify hook installation
|
|
364
|
+
nemesis kairos hooks remove # Uninstall hooks
|
|
365
|
+
nemesis kairos push --to Agent_Dev --type CR_DEPOSITED # Send event
|
|
366
|
+
nemesis kairos events # List pending events
|
|
367
|
+
nemesis kairos clear --agent Agent_Dev # Purge event queue
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Four hooks are installed: `SessionStart` (context injection), `UserPromptSubmit` (situation detection + turn logging), `Stop` (note generation + CR check), `PreCompact` (context re-injection).
|
|
371
|
+
|
|
372
|
+
### `nemesis auth`
|
|
373
|
+
|
|
374
|
+
Configure HCM authentication.
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
nemesis auth login # Configure URL + API key (test → save → sync shell RC)
|
|
378
|
+
nemesis auth status # Show active connection + live ping
|
|
379
|
+
nemesis auth logout # Remove credentials
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### `nemesis kars`
|
|
383
|
+
|
|
384
|
+
Browse available Kairos profiles by sector.
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
nemesis kars # Interactive sector picker
|
|
388
|
+
nemesis kars search --sector cybersecurity
|
|
389
|
+
nemesis kars search --format json
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### `nemesis audit`
|
|
393
|
+
|
|
394
|
+
Run template-based technical audits.
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
nemesis audit list # Available audit templates
|
|
398
|
+
nemesis audit run # Launch an audit (template → target → prompt generation)
|
|
399
|
+
nemesis audit reports # View generated reports
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### `nemesis inbox`
|
|
403
|
+
|
|
404
|
+
Human document pipeline: intake → Leader dispatch → Mission Contract draft.
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
nemesis inbox list # Pending documents
|
|
408
|
+
nemesis inbox add spec.pdf # Add document to inbox
|
|
409
|
+
nemesis inbox process # Dispatch to Leader for MC drafting
|
|
410
|
+
nemesis inbox history # Completed documents
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### `nemesis run`
|
|
414
|
+
|
|
415
|
+
Resume an agent session.
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
nemesis run agent:Agent_Dev # Interactive session (claude --resume)
|
|
419
|
+
nemesis run agent:Agent_Dev --p "fix the bug" # Direct prompt (headless)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Global Flags
|
|
423
|
+
|
|
424
|
+
| Flag | Description |
|
|
425
|
+
|------|-------------|
|
|
426
|
+
| `--format json\|text\|yaml` | Output format (default: `text`) |
|
|
427
|
+
| `--no-color` | Disable ANSI colors |
|
|
428
|
+
| `--verbose` | Detailed error output |
|
|
429
|
+
| `-h, --help` | Help (global and per-command) |
|
|
430
|
+
| `-V, --version` | Print version |
|
|
431
|
+
|
|
432
|
+
## Architecture
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
nemesis-cli/
|
|
436
|
+
├── src/
|
|
437
|
+
│ ├── index.js # Entry point (#!/usr/bin/env node)
|
|
438
|
+
│ ├── cli.js # Command dispatcher + interactive menu (18 commands)
|
|
439
|
+
│ ├── config.js # Config loader + project auto-detection
|
|
440
|
+
│ └── commands/ # One handler per command
|
|
441
|
+
│ ├── init.js # nemesis init
|
|
442
|
+
│ ├── team.js # nemesis team (add/list/inspect/remove)
|
|
443
|
+
│ ├── project.js # nemesis project (status/init)
|
|
444
|
+
│ ├── mission.js # nemesis mission (init/list/inspect)
|
|
445
|
+
│ ├── odm.js # nemesis odm (init/list/inspect)
|
|
446
|
+
│ ├── status.js # nemesis status
|
|
447
|
+
│ ├── hcm.js # nemesis hcm (sync/status/search)
|
|
448
|
+
│ ├── doctor.js # nemesis doctor
|
|
449
|
+
│ ├── orch.js # nemesis orch (orchestration dashboard)
|
|
450
|
+
│ ├── services.js # nemesis services (LLM connections + hooks)
|
|
451
|
+
│ ├── notes.js # nemesis notes (browse notes/CRs)
|
|
452
|
+
│ ├── notewriter.js # nemesis notewriter (agent memory management)
|
|
453
|
+
│ ├── kairos.js # nemesis kairos (hooks + event bus)
|
|
454
|
+
│ ├── auth.js # nemesis auth (HCM credentials)
|
|
455
|
+
│ ├── kars.js # nemesis kars (profile search)
|
|
456
|
+
│ ├── audit.js # nemesis audit (technical audits)
|
|
457
|
+
│ ├── inbox.js # nemesis inbox (document pipeline)
|
|
458
|
+
│ ├── run.js # nemesis run (resume agent session)
|
|
459
|
+
│ └── _helpers.js # Shared utilities (ensureProject, pickFromList)
|
|
460
|
+
├── lib/
|
|
461
|
+
│ ├── core/ # Business logic (pure functions, no UI)
|
|
462
|
+
│ │ ├── project.js # initProject, detectProject, getProjectStatus
|
|
463
|
+
│ │ ├── team.js # teamAdd, teamList, teamInspect, teamRemove
|
|
464
|
+
│ │ ├── registry.js # Registry CRUD (addLane, removeLane, getLanes)
|
|
465
|
+
│ │ ├── odm.js # initOdm, listOdm, inspectOdm, setOdmStatus
|
|
466
|
+
│ │ ├── mission.js # initMission, listMissions, inspectMission
|
|
467
|
+
│ │ ├── templates.js # Template loading (priority: .nemesis > .owner > embedded)
|
|
468
|
+
│ │ ├── generators.js # Generate memory.md, onboarding prompts, CLAUDE.md updates
|
|
469
|
+
│ │ ├── logger.js # Minimal stderr logger (warn, error, debug)
|
|
470
|
+
│ │ ├── secrets.js # AES-256-GCM encryption with PBKDF2 key derivation
|
|
471
|
+
│ │ ├── audit.js # Audit template management + prompt generation
|
|
472
|
+
│ │ ├── inbox.js # Document pipeline (pending → processing → done)
|
|
473
|
+
│ │ ├── connexions.js # LLM provider connection registry
|
|
474
|
+
│ │ ├── services.js # Service configuration (assignments, fallback chains)
|
|
475
|
+
│ │ ├── agent-launcher.js # Spawn Claude CLI with streaming JSON parsing
|
|
476
|
+
│ │ ├── profile-picker.js # Kairos profile selection from HCM
|
|
477
|
+
│ │ ├── notewriter/ # Agent memory system
|
|
478
|
+
│ │ │ ├── config.js # NoteWriter configuration (enable, timers, levels)
|
|
479
|
+
│ │ │ ├── log.js # Session turn logging (JSONL, open/close)
|
|
480
|
+
│ │ │ ├── notes.js # Note generation via LLM (L1-L5 depth)
|
|
481
|
+
│ │ │ ├── cr.js # CR generation (combine notes, LLM summary)
|
|
482
|
+
│ │ │ ├── reader.js # Timeline + filtering across notes/CRs
|
|
483
|
+
│ │ │ ├── paths.js # Path resolution (month-bucketed directories)
|
|
484
|
+
│ │ │ └── registry.js # Notes/CRs index with sequential IDs
|
|
485
|
+
│ │ └── flowmap/ # Workflow state machine (XState v5)
|
|
486
|
+
│ │ ├── machine.js # 18-state workflow (F00→FIN)
|
|
487
|
+
│ │ ├── api.js # Actor management + event dispatch
|
|
488
|
+
│ │ ├── persistence.js # XState snapshot I/O
|
|
489
|
+
│ │ └── cli-helpers.js # Display helpers for flowmap status
|
|
490
|
+
│ ├── kairos/ # Agent orchestration hooks
|
|
491
|
+
│ │ ├── hook-handlers.js # 4 hook entry points (pre/dynamic/post/compact)
|
|
492
|
+
│ │ ├── hook-installer.js # Claude Code hooks installation
|
|
493
|
+
│ │ ├── context-injector.js # Unified context injection via stdout
|
|
494
|
+
│ │ ├── context-writer.js # Situation persistence
|
|
495
|
+
│ │ ├── context-loader.js # Agent context resolution
|
|
496
|
+
│ │ ├── situation-detector.js # Keyword-based situation detection
|
|
497
|
+
│ │ ├── agent-runner.js # Headless agent dispatch + result polling
|
|
498
|
+
│ │ ├── dispatcher.js # LLM response classification (LEADER/HUMAN/NOISE)
|
|
499
|
+
│ │ ├── dispatcher-router.js # File-based routing for dispatch results
|
|
500
|
+
│ │ ├── event-bus.js # Async event queue (TTL, priority, per-agent)
|
|
501
|
+
│ │ ├── event-router.js # Event routing to agents
|
|
502
|
+
│ │ ├── flowmap-bridge.js # Signal detection → flowmap events
|
|
503
|
+
│ │ ├── pid-checker.js # Agent PID registration + liveness
|
|
504
|
+
│ │ ├── leader-rules.js # Leader-specific dispatch/validation rules
|
|
505
|
+
│ │ ├── hook-prompts.js # Prompt templates for hooks
|
|
506
|
+
│ │ └── claude-invoker.js # Claude CLI invocation wrapper
|
|
507
|
+
│ ├── sync/ # HCM + LLM communication
|
|
508
|
+
│ │ ├── hcm-client.js # HCM HTTP client (vanilla fetch, Node 20+)
|
|
509
|
+
│ │ ├── sync-engine.js # Hash-based scan/diff/sync engine
|
|
510
|
+
│ │ ├── health.js # HCM connection diagnostic
|
|
511
|
+
│ │ ├── nemesis-client.js # Nemesis API client
|
|
512
|
+
│ │ ├── llm-client.js # Multi-provider LLM client
|
|
513
|
+
│ │ ├── service-session.js # LLM API caller with fallback
|
|
514
|
+
│ │ └── fallback-engine.js # Silent cascade across connections
|
|
515
|
+
│ └── ui/ # Terminal display
|
|
516
|
+
│ ├── brand.js # ARKA LABS ASCII logo + branded headers
|
|
517
|
+
│ ├── colors.js # ANSI color system (NO_COLOR / FORCE_COLOR aware)
|
|
518
|
+
│ ├── box.js # Unicode box drawing (emoji-aware width)
|
|
519
|
+
│ ├── table.js # ASCII table renderer
|
|
520
|
+
│ ├── tree.js # Hierarchical tree renderer
|
|
521
|
+
│ ├── menu.js # Interactive keyboard menu (arrows, j/k, scrolling)
|
|
522
|
+
│ ├── prompt.js # Interactive prompts (text, choice, confirm)
|
|
523
|
+
│ ├── spinner.js # Braille-pattern loading spinner
|
|
524
|
+
│ ├── format.js # Output formatter (JSON / YAML / text)
|
|
525
|
+
│ ├── dashboard.js # Orchestration dashboard (real-time monitoring)
|
|
526
|
+
│ ├── streambox.js # Streaming JSON output renderer
|
|
527
|
+
│ ├── note-card.js # Note/CR card components
|
|
528
|
+
│ ├── note-colors.js # Level-based color system (L1-L5)
|
|
529
|
+
│ ├── note-detail.js # Note/CR detail views
|
|
530
|
+
│ ├── note-filters.js # Filter panel UI
|
|
531
|
+
│ ├── note-views.js # Agent/timeline views
|
|
532
|
+
│ └── error-hints.js # User-friendly error suggestions
|
|
533
|
+
├── templates/ # 9 embedded JSON templates
|
|
534
|
+
└── test/ # 862 tests across 88 files
|
|
535
|
+
├── unit/ # Pure function tests (68 files)
|
|
536
|
+
├── integration/ # Multi-module tests with temp directories (12 files)
|
|
537
|
+
└── e2e/ # Full workflow test
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### How It Fits Together
|
|
541
|
+
|
|
542
|
+
```
|
|
543
|
+
┌──────────────────┐
|
|
544
|
+
│ HCM Graph │
|
|
545
|
+
│ (remote API) │
|
|
546
|
+
└────────▲──────────┘
|
|
547
|
+
│ sync (hash-based)
|
|
548
|
+
┌──────────────┐ ┌────────┴──────────┐
|
|
549
|
+
│ PM (human) │◄────────►│ nemesis CLI │
|
|
550
|
+
│ via terminal│ │ │
|
|
551
|
+
└──────────────┘ │ reads/writes │
|
|
552
|
+
│ .nemesis/HCM/ │
|
|
553
|
+
└────────▲──────────┘
|
|
554
|
+
│ JSON files
|
|
555
|
+
┌────────┴──────────┐
|
|
556
|
+
│ AI Agents │
|
|
557
|
+
│ (Claude Code) │
|
|
558
|
+
│ │
|
|
559
|
+
│ write OdM, CR, │
|
|
560
|
+
│ decisions, etc. │
|
|
561
|
+
└───────────────────┘
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
**Data flow:** Agents produce structured JSON artifacts (OdMs, CRs, decisions) in `.nemesis/HCM/`. Kairos hooks inject context at session start, detect situations dynamically, generate notes/CRs on each turn, and route dispatch results through the configured routing chain. The orchestrator daemon (`nemesis orch`) auto-dispatches OdMs and monitors the entire lifecycle. The PM uses Nemesis CLI to observe progress, manage the team, and orchestrate work.
|
|
565
|
+
|
|
566
|
+
### Design Principles
|
|
567
|
+
|
|
568
|
+
1. **File-first** — All data lives in `.nemesis/HCM/` as JSON files. No local database.
|
|
569
|
+
2. **Read-heavy, write-light** — The CLI reads a lot (status, inspect, list) and writes little (init, team add). Agents do the writing.
|
|
570
|
+
3. **Daemon-light** — `nemesis orch` provides real-time orchestration via filesystem polling (no background service required).
|
|
571
|
+
4. **Minimal dependencies** — Only xstate (workflow state machine) at runtime. All UI, crypto, and I/O use Node.js built-ins.
|
|
572
|
+
5. **Portable** — Works on any repo. Auto-detects project from `.nemesis/HCM/project/CONTEXT_PROJECT_*.json`.
|
|
573
|
+
|
|
574
|
+
## Configuration
|
|
575
|
+
|
|
576
|
+
### Config File
|
|
577
|
+
|
|
578
|
+
Optional global configuration at `~/.nemesis/config.json`:
|
|
579
|
+
|
|
580
|
+
```json
|
|
581
|
+
{
|
|
582
|
+
"defaults": {
|
|
583
|
+
"hcm_url": "https://hcm.arkalabs.app",
|
|
584
|
+
"hcm_api_key_env": "HCM_API_KEY"
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### Environment Variables
|
|
590
|
+
|
|
591
|
+
| Variable | Description | Default |
|
|
592
|
+
|----------|-------------|---------|
|
|
593
|
+
| `HCM_URL` | HCM API base URL | `https://hcm.arkalabs.app` |
|
|
594
|
+
| `HCM_API_KEY` | API key for HCM authentication | (none) |
|
|
595
|
+
| `NO_COLOR` | Disable all ANSI colors ([no-color.org](https://no-color.org)) | — |
|
|
596
|
+
| `FORCE_COLOR` | Force colors even without TTY | — |
|
|
597
|
+
| `NEMESIS_COLOR` | Override color detection (`0` = off, `1` = on) | — |
|
|
598
|
+
| `NEMESIS_VERBOSE` | Enable debug logging to stderr (`1` = on) | — |
|
|
599
|
+
|
|
600
|
+
### Project Auto-Detection
|
|
601
|
+
|
|
602
|
+
The CLI auto-detects the current project by looking for:
|
|
603
|
+
|
|
604
|
+
1. `.nemesis/HCM/project/CONTEXT_PROJECT_*.json` (primary)
|
|
605
|
+
2. `.owner/HCM/project/CONTEXT_PROJECT_*.json` (legacy fallback)
|
|
606
|
+
|
|
607
|
+
No project detected? Run `nemesis init` or the CLI will offer to initialize one interactively.
|
|
608
|
+
|
|
609
|
+
### Template Priority
|
|
610
|
+
|
|
611
|
+
When loading templates for new documents (OdM, CR, Mission Contract, etc.):
|
|
612
|
+
|
|
613
|
+
1. `.nemesis/template/` (project-specific overrides)
|
|
614
|
+
2. `.owner/template/` (legacy path)
|
|
615
|
+
3. `templates/` (embedded defaults shipped with the package)
|
|
616
|
+
|
|
617
|
+
## Embedded Templates
|
|
618
|
+
|
|
619
|
+
Nemesis ships with 9 JSON templates for structured documents:
|
|
620
|
+
|
|
621
|
+
| Template | Purpose |
|
|
622
|
+
|----------|---------|
|
|
623
|
+
| `template_ODM-NAME-000.json` | Ordre de Mission |
|
|
624
|
+
| `template_CR-ODM-NAME-000.exemple.json` | Compte-Rendu (delivery report) |
|
|
625
|
+
| `template_MISSION_CONTRACT.json` | Mission Contract (work package) |
|
|
626
|
+
| `template_REGISTRY-PROJECT.json` | Team registry |
|
|
627
|
+
| `template_DEC-NAME-000.json` | Decision record |
|
|
628
|
+
| `template_INTV-NAME-000.json` | Intervention log |
|
|
629
|
+
| `template_CONTRIB-NAME.json` | Contributor card |
|
|
630
|
+
| `template_TXN-NAME-000.json` | Transaction record |
|
|
631
|
+
| `project-context.json` | Project context |
|
|
632
|
+
|
|
633
|
+
## Development
|
|
634
|
+
|
|
635
|
+
```bash
|
|
636
|
+
# Clone the repository
|
|
637
|
+
git clone https://github.com/arka-squad/arkalabs-nemesis-cli.git
|
|
638
|
+
cd arkalabs-nemesis-cli
|
|
639
|
+
|
|
640
|
+
# Install dependencies
|
|
641
|
+
npm install
|
|
642
|
+
|
|
643
|
+
# Link for local development
|
|
644
|
+
npm link
|
|
645
|
+
|
|
646
|
+
# Run tests
|
|
647
|
+
npm test # 862 tests across 88 files
|
|
648
|
+
npm run test:watch # Watch mode
|
|
649
|
+
npm run test:coverage # With coverage report (v8, thresholds: 50% lines / 60% functions)
|
|
650
|
+
npm run lint # ESLint check
|
|
651
|
+
npm run lint:fix # ESLint auto-fix
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### Test Structure
|
|
655
|
+
|
|
656
|
+
862 tests across 88 files, organized in three categories:
|
|
657
|
+
|
|
658
|
+
- **Unit** (`test/unit/`, 68 files) — pure function tests covering core logic, UI components, kairos hooks, notewriter, flowmap, dispatcher, event bus, secrets, logger, and more
|
|
659
|
+
- **Integration** (`test/integration/`, 12 files) — multi-module tests with temp directories (init, team, mission, odm, doctor, hcm-sync, services, event-bus, orch-dashboard, nemesis-mcp)
|
|
660
|
+
- **E2E** (`test/e2e/`, 1 file) — full workflow: init → team → mission → odm → sync → remove
|
|
661
|
+
|
|
662
|
+
## Contributing
|
|
663
|
+
|
|
664
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute.
|
|
665
|
+
|
|
666
|
+
## License
|
|
667
|
+
|
|
668
|
+
[Apache License 2.0](LICENSE) — ARKA LABS
|