claude-comms 1.0.34 → 1.0.36

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/.agents/AGENTS.md CHANGED
@@ -43,11 +43,11 @@ Evaluate the Change for a given Assignment/Task against the following criteria:
43
43
 
44
44
 
45
45
  [VALIDATE]
46
- Run required commands — all must pass without warnings or errors:
47
- - `pnpm lint`
48
- - `pnpm ts:check`
49
- - `pnpm test:all`
50
- - `pnpm build`
46
+ Run required commands from `.agents/repo.md` — all must pass without warnings or errors:
47
+ - lint
48
+ - typecheck
49
+ - build
50
+ - test
51
51
 
52
52
  [UAT]
53
53
  Perform manual QA:
@@ -58,4 +58,4 @@ Perform manual QA:
58
58
 
59
59
  [/AGENT OPERATING PROCEDURES]
60
60
 
61
- # Repository Guidelines: see `.agents/repo.md`
61
+ # Adhere to the Repository Guidelines: `.agents/repo.md`
package/.agents/repo.md CHANGED
@@ -1,29 +1,15 @@
1
1
 
2
2
  # Repository Guidelines
3
+ VALIDATE by Running required commands — all must pass without warnings or errors:
4
+ - `pnpm lint`
5
+ - `pnpm ts:check`
6
+ - `pnpm test:all`
7
+ - `pnpm build`
3
8
 
4
- ## Project Structure & Module Organization
5
- - `apps/server` hosts the Bun observability API; routes stay in `src/index.ts`, persistence helpers in `src/db.ts`, and regression suites in `src/__tests__`.
6
- - `apps/client` contains the Vue dashboard; UI modules live in `src/components` and `src/views` with Vitest and Playwright specs under `tests/`.
7
- - `packages/setup-installer` ships the `claude-comms` NPX CLI; logic resides in `src/`, distributable templates in `templates/`, and Jest suites across `test/unit`, `test/integration`, and `test/e2e`.
8
- - `.claude/hooks/*` stores Python-powered agents, while `scripts/` provides operational helpers such as `start-system.sh`, `reset-system.sh`, and telemetry generators.
9
9
 
10
- ## Build, Test, and Development Commands
11
- - `./scripts/start-system.sh` boots the Bun API, Vue dashboard, and SQLite broker for an end-to-end stack from the repo root.
12
- - `cd apps/server && bun install && bun run dev` starts the API with hot reload; use `bun run start` for production parity and `bun run typecheck` before merging.
13
- - `cd apps/client && bun install && bun run dev` launches the dashboard; `bun run build` compiles the Vite bundle and `bun run preview` smoke-tests it.
14
- - `cd packages/setup-installer && npm install && npm test` validates the installer; run `npm run lint` or `npm run test:coverage` when altering CLI behavior or templates.
10
+ ## Dev server
11
+ `pnpm dev | tee -a dev.log` is already running in the background. check the `dev.log` file. Avoid starting up a new instance as it will bump the port.
12
+ you can access the client on `http://localhost:3000/` using the UAT toolkit
15
13
 
16
- ## Coding Style & Naming Conventions
17
- - Use 2-space indentation, `camelCase` utilities, `PascalCase` components and types, and co-locate shared shapes in `apps/*/src/types.ts`.
18
- - Keep persistence isolated to `apps/server/src/db.ts`; expose new queries through typed helpers rather than inline SQL inside request handlers.
19
- - In the dashboard prefer composables in `src/composables`, Tailwind utility classes, and structured logging or toast utilities instead of raw `console.log` calls.
20
-
21
- ## Testing Guidelines
22
- - Backend suites live in `apps/server/src/__tests__` with `.test.ts` suffixes; run `bun run test` or `bun run test:coverage` whenever mutating server logic.
23
- - Dashboard coverage pairs Vitest (`bun run test`) with Playwright smoke tests in `apps/client/tests/playwright`; refresh artifacts in `tests/visual` when UI states change.
24
- - Installer validation relies on Jest; execute `npm run test:integration` after template edits and `npm run test:e2e` before publishing new packages.
25
-
26
- ## Commit & Pull Request Guidelines
27
- - History favors short, imperative subjects (`remove matrix mode`) with selective conventional prefixes (`chore(release): 1.0.23`); follow that tone and omit trailing periods.
28
- - Reference issues and describe agent-facing impact in PR descriptions; attach dashboard screenshots or installer logs whenever UX or setup flows shift.
29
- - Before requesting review, ensure `./scripts/test-system.sh` plus relevant package checks pass and call out skipped suites or follow-up tasks in the PR notes.
14
+ ## Documentation Protocol
15
+ Guard the doc hierarchy: specs in `docs/project/spec/` remain the source of truth (Businesslogic, data dictionary, data flows, tech guide, industry references); guides in `docs/project/guides/` capture evolving process; phase folders (`docs/project/phases/XX-Name/`) store live work packages and notes. Update whichever doc you rely on as soon as the code diverges.
@@ -0,0 +1,208 @@
1
+ # Agent Job Adapter
2
+
3
+ Self-contained `uv` Python scripts that turn verbose CLI agent runs (Codex, Gemini CLI) into **file-backed jobs** with stable IDs and cheap status checks.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Spawn a new job (returns immediately)
9
+ uv run agent_job.py spawn --harness codex -- "your assignment here"
10
+ # Output: Agent running. Check status with: `uv run agent_job.py status <job_id>`
11
+
12
+ # Check job status
13
+ uv run agent_job.py status <job_id>
14
+
15
+ # List all jobs
16
+ uv run agent_job.py list
17
+
18
+ # Monitor jobs with TUI
19
+ uv run agent_monitor.py
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ ### `spawn`
25
+
26
+ Starts a new agent job with the specified harness. Returns immediately after initialization.
27
+
28
+ ```bash
29
+ uv run agent_job.py spawn --harness <gemini|codex> -- "<assignment>"
30
+ ```
31
+
32
+ **Output:**
33
+ ```
34
+ Agent running. Check status with: `uv run agent_job.py status 019abd9d-8cb2-7e81-bae9-2a8fe5be04fa`
35
+ ```
36
+
37
+ ### `status`
38
+
39
+ Get current status of a job with computed runtime metrics.
40
+
41
+ ```bash
42
+ uv run agent_job.py status <job_id>
43
+ ```
44
+
45
+ **Running job output:**
46
+ ```json
47
+ {
48
+ "job_id": "019abd9d-8cb2-7e81-bae9-2a8fe5be04fa",
49
+ "harness": "codex",
50
+ "pid": 12345,
51
+ "logs": "/path/to/agent.log",
52
+ "status": "running",
53
+ "status_reason": "command_execution",
54
+ "start_time": "2025-11-25T08:10:06.262Z",
55
+ "last_event_time": "2025-11-25T08:10:29.337Z",
56
+ "runtime_sec": 23.1,
57
+ "idle_sec": 4.0,
58
+ "operations": 18
59
+ }
60
+ ```
61
+
62
+ **Completed job output:**
63
+ ```json
64
+ {
65
+ "job_id": "019abd9d-8cb2-7e81-bae9-2a8fe5be04fa",
66
+ "harness": "codex",
67
+ "pid": 12345,
68
+ "logs": "/path/to/agent.log",
69
+ "status": "complete",
70
+ "status_reason": "completed",
71
+ "start_time": "2025-11-25T08:10:06.262Z",
72
+ "last_event_time": "2025-11-25T08:10:29.337Z",
73
+ "runtime_sec": 23.1,
74
+ "operations": 18,
75
+ "end_time": "2025-11-25T08:10:29.340Z",
76
+ "completion": {
77
+ "messages": ["Task completed successfully."],
78
+ "tokens": { "input": 7288, "output": 84, "total": 7372 },
79
+ "duration_ms": 13845
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### `list`
85
+
86
+ List all jobs with full status information.
87
+
88
+ ```bash
89
+ uv run agent_job.py list
90
+ ```
91
+
92
+ ## Monitor TUI
93
+
94
+ Real-time terminal UI for monitoring agent jobs, similar to `top`.
95
+
96
+ ```bash
97
+ uv run agent_monitor.py # Default 2s refresh
98
+ uv run agent_monitor.py --interval 5 # Custom refresh interval
99
+ ```
100
+
101
+ **Features:**
102
+ - Color-coded status indicators:
103
+ - `●` Yellow = running
104
+ - `✓` Green = complete
105
+ - `✗` Red = error
106
+ - `⏱` Red = timeout
107
+ - Columns: Status, Harness, Job ID, Status Reason, Started, Runtime, Operations
108
+ - Scrollable log viewer
109
+
110
+ **Keyboard Controls:**
111
+
112
+ | Key | Action |
113
+ |-----|--------|
114
+ | `↑/↓` or `j/k` | Navigate job list |
115
+ | `Enter` | View job log |
116
+ | `r` | Refresh / reload log |
117
+ | `q` | Quit |
118
+
119
+ **Log View Controls:**
120
+
121
+ | Key | Action |
122
+ |-----|--------|
123
+ | `↑/↓` or `j/k` | Scroll line by line |
124
+ | `PgUp/PgDn` | Scroll by page |
125
+ | `Home/End` | Jump to start/end |
126
+ | `r` | Reload log file |
127
+ | `ESC` | Back to job list |
128
+
129
+ ## Job Status
130
+
131
+ | Status | Description |
132
+ |--------|-------------|
133
+ | `running` | Job is currently executing |
134
+ | `complete` | Job finished successfully |
135
+ | `error` | Job failed (see `status_reason`) |
136
+ | `timeout` | Job killed due to idle timeout |
137
+
138
+ ## Status Reason
139
+
140
+ The `status_reason` field shows current activity while running:
141
+
142
+ **Codex:**
143
+ - `initializing` - Job starting up
144
+ - `thinking` - Turn started
145
+ - `reasoning` - Agent reasoning
146
+ - `command_execution` - Running shell command
147
+ - `todo_list` - Managing todos
148
+ - `agent_message` - Generating response
149
+ - `completed` - Finished
150
+
151
+ **Gemini:**
152
+ - `initializing` - Job starting up
153
+ - `run_shell_command` - Running command
154
+ - `write_file` / `read_file` - File operations
155
+ - `write_todos` - Managing todos
156
+ - `responding` - Generating response
157
+ - `completed` - Finished
158
+
159
+ ## Configuration
160
+
161
+ | Environment Variable | Default | Description |
162
+ |---------------------|---------|-------------|
163
+ | `AGENT_JOBS_ROOT` | `$TMPDIR/agent_jobs/$USER` | Root directory for job files |
164
+ | `IDLE_TIMEOUT_SEC` | `300` | Seconds of inactivity before killing job |
165
+
166
+ ## File Structure
167
+
168
+ Each job creates a directory under `AGENT_JOBS_ROOT`:
169
+
170
+ ```
171
+ <jobs_root>/<job_id>/
172
+ status.json # Current job state (updated on each event)
173
+ agent.log # Raw harness output (appended in real-time)
174
+ ```
175
+
176
+ ## Supported Harnesses
177
+
178
+ ### Codex
179
+
180
+ Uses `codex --yolo e "<assignment>" --json`
181
+
182
+ Events handled:
183
+ - `thread.started` - Extracts job ID (thread_id)
184
+ - `turn.started` - Sets status_reason to "thinking"
185
+ - `item.started/completed` - Updates status_reason with item type
186
+ - `turn.completed` - Extracts token usage
187
+
188
+ ### Gemini CLI
189
+
190
+ Uses `gemini --yolo -s -m gemini-3-pro-preview --output-format stream-json "<assignment>"`
191
+
192
+ Events handled:
193
+ - `init` - Extracts session ID as job ID
194
+ - `tool_use` - Updates status_reason with tool name
195
+ - `message` (assistant) - Accumulates response text
196
+ - `result` - Extracts token stats and duration
197
+
198
+ ## Babysitter Pattern
199
+
200
+ For autonomous monitoring:
201
+
202
+ 1. **Spawn** the job - returns immediately with job ID
203
+ 2. **Poll** status periodically
204
+ 3. **React** based on status:
205
+ - `running` - Check `idle_sec`, continue monitoring
206
+ - `complete` - Read `completion.messages`
207
+ - `timeout` - Report idle timeout exceeded
208
+ - `error` - Check `status_reason` and logs