iosm-cli 0.2.9 → 0.2.11
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/CHANGELOG.md +67 -0
- package/README.md +11 -2
- package/dist/core/agent-session.d.ts +9 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +425 -50
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/background-processes.d.ts +31 -0
- package/dist/core/background-processes.d.ts.map +1 -0
- package/dist/core/background-processes.js +241 -0
- package/dist/core/background-processes.js.map +1 -0
- package/dist/core/bash-executor.d.ts +6 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +19 -2
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +23 -4
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/mcp/runtime.d.ts.map +1 -1
- package/dist/core/mcp/runtime.js +2 -0
- package/dist/core/mcp/runtime.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +2 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +30 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +17 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +29 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +8 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagents.d.ts +10 -2
- package/dist/core/subagents.d.ts.map +1 -1
- package/dist/core/subagents.js +66 -17
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/system-prompt.d.ts +25 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +146 -14
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +28 -2
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/permissions.d.ts +3 -0
- package/dist/core/tools/permissions.d.ts.map +1 -1
- package/dist/core/tools/permissions.js.map +1 -1
- package/dist/core/tools/task.d.ts +3 -1
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +48 -23
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/ultrathink.d.ts +122 -0
- package/dist/core/ultrathink.d.ts.map +1 -0
- package/dist/core/ultrathink.js +621 -0
- package/dist/core/ultrathink.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +93 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +281 -24
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +10 -0
- package/docs/configuration.md +57 -1
- package/docs/development-and-testing.md +3 -2
- package/docs/extensions-packages-themes.md +27 -0
- package/docs/interactive-mode.md +7 -0
- package/docs/orchestration-and-subagents.md +16 -0
- package/docs/rpc-json-sdk.md +14 -0
- package/docs/sessions-traces-export.md +7 -0
- package/package.json +1 -1
package/docs/cli-reference.md
CHANGED
|
@@ -127,6 +127,14 @@ These commands run inside interactive mode (`iosm`), not as top-level CLI subcom
|
|
|
127
127
|
- baseline repository scan + standard agent pass
|
|
128
128
|
- outputs exactly 3 implementation options with recommendation
|
|
129
129
|
- lets user choose option `1/2/3`, then `Start with Swarm` or `Continue without Swarm`
|
|
130
|
+
- `/ultrathink [-q N|--iterations N] [query]` — deep read-only iterative analysis:
|
|
131
|
+
- runs root-agent analysis in strict read-only tool mode for `N` iterations (default `5`, max `12`)
|
|
132
|
+
- carries compact checkpoint state between iterations (facts, rejected hypotheses, open questions, next checks)
|
|
133
|
+
- auto-injects a grounding retry when early passes return no tool evidence, forcing live workspace probes
|
|
134
|
+
- if query is omitted, reuses latest meaningful user request from session context
|
|
135
|
+
- `/bg [list [limit]|status [id]|logs [id] [lines]|stop [id]]` — interactive background shell process manager:
|
|
136
|
+
- run detached shell commands with `! <command> &`
|
|
137
|
+
- inspect process state, log tail, and stop running background jobs
|
|
130
138
|
- `/swarm` — canonical gated execution runtime:
|
|
131
139
|
- `/swarm run <task> [--max-parallel N] [--budget-usd X]`
|
|
132
140
|
- `/swarm from-singular <run-id> --option <1|2|3> [--max-parallel N] [--budget-usd X]`
|
|
@@ -260,6 +268,7 @@ iosm --api-key sk-test-123 # Override for this run
|
|
|
260
268
|
`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `rg`, `fd`, `ast_grep`, `comby`, `jq`, `yq`, `semgrep`, `sed`, `semantic_search`, `fetch`, `web_search`, `git_read`, `git_write`, `fs_ops`, `test_run`, `lint_run`, `typecheck_run`, `db_run`, `todo_read`, `todo_write`
|
|
261
269
|
|
|
262
270
|
Tool notes:
|
|
271
|
+
- `bash` supports optional `run_in_background=true` for detached execution; returned details include `backgroundTaskId` and metadata/log paths.
|
|
263
272
|
- `rg`, `fd` are managed by iosm-cli and auto-resolved when missing.
|
|
264
273
|
- `ast_grep`, `comby`, `jq`, `yq`, `semgrep` are optional external CLIs and should be available in `PATH` to use their tools.
|
|
265
274
|
- `sed` tool is preview/extraction-oriented; in-place edits are intentionally blocked.
|
|
@@ -293,6 +302,7 @@ Best-practice patterns:
|
|
|
293
302
|
- File exploration: use bounded reads/searches (`path`, `glob`, `context`, `limit`); for large files, page with `read` using `offset`/`limit` instead of dumping whole files.
|
|
294
303
|
- File mutation: prefer `edit` for surgical changes and `write` for full rewrites; use `fs_ops` for `mkdir/move/copy/delete`, with `force=true` only when replacement/no-op behavior is intentional.
|
|
295
304
|
- Verification: prefer `test_run` / `lint_run` / `typecheck_run` over ad-hoc bash commands for deterministic runner resolution and normalized status reporting.
|
|
305
|
+
- Long-running shell jobs: prefer detached `bash` (`run_in_background=true`) or interactive `! <command> &`, then monitor with `/bg` instead of blocking the foreground turn.
|
|
296
306
|
- DB operations: prefer `db_run` with named profiles; keep read flows in `query/schema/explain` and use `allow_write=true` only for `exec/migrate`.
|
|
297
307
|
- Structured data transforms: use `jq`/`yq` to compute/preview transforms, then persist the final state through `edit`/`write`.
|
|
298
308
|
- Semantic retrieval: use `semantic_search status` first when relevance looks stale, then run `query`; run `index`/`rebuild` when config or index freshness requires it.
|
package/docs/configuration.md
CHANGED
|
@@ -101,8 +101,15 @@ Settings are merged in this order (later wins):
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
|
+
"promptContext": {
|
|
105
|
+
"enableContextDedupe": true,
|
|
106
|
+
"maxContextCharsPerFile": 4000,
|
|
107
|
+
"maxTotalContextChars": 12000,
|
|
108
|
+
"enableGitSnapshotContext": false
|
|
109
|
+
},
|
|
104
110
|
"permissions": {
|
|
105
|
-
"autoApprove": false
|
|
111
|
+
"autoApprove": false,
|
|
112
|
+
"extensionToolEnforcement": false
|
|
106
113
|
}
|
|
107
114
|
}
|
|
108
115
|
```
|
|
@@ -110,6 +117,8 @@ Settings are merged in this order (later wins):
|
|
|
110
117
|
`githubTools.networkEnabled` controls whether `git_write` network actions (`fetch`, `pull`, `push`) are allowed.
|
|
111
118
|
`githubTools.token` is optional and, when set, is injected for GitHub HTTPS authentication during network git actions.
|
|
112
119
|
`dbTools` defines named DB connection profiles consumed by `db_run`; for network adapters (`postgres`, `mysql`, `mongodb`, `redis`) use `dsnEnv` so secrets stay in environment variables instead of tool input.
|
|
120
|
+
`promptContext` controls system prompt context compaction before model call: dedupe by normalized content hash, per-file char budget, total char budget, and optional git snapshot context inclusion.
|
|
121
|
+
`permissions.extensionToolEnforcement` enables strict runtime permission tier checks for extension tools (off by default).
|
|
113
122
|
|
|
114
123
|
### `db_run` Setup (Recommended)
|
|
115
124
|
|
|
@@ -389,6 +398,53 @@ Permissions control tool execution approval behavior.
|
|
|
389
398
|
- **Shell commands**: Whether `bash` executions require approval
|
|
390
399
|
- **Destructive actions**: Special handling for `rm`, `sudo`, etc.
|
|
391
400
|
|
|
401
|
+
### Extension Tool Permission Tiers
|
|
402
|
+
|
|
403
|
+
Extension tools can declare one of the runtime tiers:
|
|
404
|
+
|
|
405
|
+
- `read-only`
|
|
406
|
+
- `workspace-write`
|
|
407
|
+
- `danger-full-access`
|
|
408
|
+
|
|
409
|
+
When `permissions.extensionToolEnforcement=true`, interactive mode enforces stricter behavior for extension tools:
|
|
410
|
+
|
|
411
|
+
- in `auto` mode, extension tools marked `read-only` are allowed automatically
|
|
412
|
+
- extension tools missing `requiredPermission` metadata are blocked in `auto` mode (with warning)
|
|
413
|
+
- `ask` and `yolo` modes keep their expected approval semantics
|
|
414
|
+
|
|
415
|
+
Example:
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"permissions": {
|
|
420
|
+
"extensionToolEnforcement": true
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Prompt Context Budgets
|
|
426
|
+
|
|
427
|
+
`promptContext` applies deterministic preprocessing to loaded context files before they are appended to the system prompt:
|
|
428
|
+
|
|
429
|
+
- normalize line endings and trim
|
|
430
|
+
- optional dedupe by normalized-content hash
|
|
431
|
+
- per-file cap (`maxContextCharsPerFile`)
|
|
432
|
+
- total cap (`maxTotalContextChars`)
|
|
433
|
+
- optional git snapshot context (`enableGitSnapshotContext`)
|
|
434
|
+
|
|
435
|
+
Default values:
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"promptContext": {
|
|
440
|
+
"enableContextDedupe": true,
|
|
441
|
+
"maxContextCharsPerFile": 4000,
|
|
442
|
+
"maxTotalContextChars": 12000,
|
|
443
|
+
"enableGitSnapshotContext": false
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
392
448
|
### Safety Defaults
|
|
393
449
|
|
|
394
450
|
By default, `iosm-cli` asks for confirmation before:
|
|
@@ -38,6 +38,7 @@ iosm-cli/
|
|
|
38
38
|
│ │ ├── skills.ts # Skill discovery and loading
|
|
39
39
|
│ │ ├── prompt-templates.ts # Prompt template system
|
|
40
40
|
│ │ ├── bash-executor.ts # Shell command execution
|
|
41
|
+
│ │ ├── background-processes.ts # Detached background process runtime
|
|
41
42
|
│ │ ├── tools/ # Built-in tools
|
|
42
43
|
│ │ │ ├── read.ts # File reading
|
|
43
44
|
│ │ │ ├── bash.ts # Shell execution
|
|
@@ -70,7 +71,7 @@ iosm-cli/
|
|
|
70
71
|
│ ├── clipboard.ts # Clipboard access
|
|
71
72
|
│ ├── image-resize.ts # Image processing
|
|
72
73
|
│ └── ...
|
|
73
|
-
├── test/ # Vitest test suite (
|
|
74
|
+
├── test/ # Vitest test suite (74 files)
|
|
74
75
|
├── examples/
|
|
75
76
|
│ ├── extensions/ # 66 extension examples
|
|
76
77
|
│ └── sdk/ # 12 SDK examples
|
|
@@ -157,7 +158,7 @@ Tests are organized by feature area:
|
|
|
157
158
|
|
|
158
159
|
| Area | Test Files | Coverage |
|
|
159
160
|
|------|-----------|----------|
|
|
160
|
-
| **Tools** | `tools.test.ts` | Built-in tools (`read`, `bash`, `edit`, `write`, `git_write`, `fs_ops`, `test_run`, `lint_run`, `typecheck_run`, `db_run`, `grep`, `find`, `ls`, `rg`, `fd`, `ast_grep`, `comby`, `jq`, `yq`, `semgrep`, `sed`, `semantic_search`, `fetch`, `web_search`, `git_read`) |
|
|
161
|
+
| **Tools** | `tools.test.ts`, `background-processes.test.ts` | Built-in tools (`read`, `bash`, `edit`, `write`, `git_write`, `fs_ops`, `test_run`, `lint_run`, `typecheck_run`, `db_run`, `grep`, `find`, `ls`, `rg`, `fd`, `ast_grep`, `comby`, `jq`, `yq`, `semgrep`, `sed`, `semantic_search`, `fetch`, `web_search`, `git_read`) + detached background process lifecycle |
|
|
161
162
|
| **Session** | `session-manager/`, `session-*.test.ts` | Persistence, branching, migration |
|
|
162
163
|
| **Extensions** | `extensions-*.test.ts` | Discovery, running, hooks, input events |
|
|
163
164
|
| **Compaction** | `compaction*.test.ts` | Context summarization |
|
|
@@ -47,6 +47,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
47
47
|
name: "weather",
|
|
48
48
|
label: "Weather",
|
|
49
49
|
description: "Get current weather for a city",
|
|
50
|
+
requiredPermission: "read-only",
|
|
50
51
|
parameters: Type.Object({
|
|
51
52
|
city: Type.String({ description: "City name" }),
|
|
52
53
|
}),
|
|
@@ -68,6 +69,32 @@ export default function (pi: ExtensionAPI) {
|
|
|
68
69
|
> action: StringEnum(["add", "remove", "list"] as const)
|
|
69
70
|
> ```
|
|
70
71
|
|
|
72
|
+
### Extension Tool Permission Metadata
|
|
73
|
+
|
|
74
|
+
Custom tools can declare `requiredPermission` to participate in runtime permission tier policies:
|
|
75
|
+
|
|
76
|
+
- `read-only`
|
|
77
|
+
- `workspace-write`
|
|
78
|
+
- `danger-full-access`
|
|
79
|
+
|
|
80
|
+
Example for mutating tool:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
pi.registerTool({
|
|
84
|
+
name: "repo_sync",
|
|
85
|
+
label: "Repo Sync",
|
|
86
|
+
description: "Synchronize local repository metadata cache",
|
|
87
|
+
requiredPermission: "workspace-write",
|
|
88
|
+
parameters: Type.Object({ force: Type.Optional(Type.Boolean()) }),
|
|
89
|
+
async execute(_toolCallId, params) {
|
|
90
|
+
// ...
|
|
91
|
+
return { content: [{ type: "text", text: "ok" }] };
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
When runtime setting `permissions.extensionToolEnforcement` is enabled, these tiers are used in interactive permission flow.
|
|
97
|
+
|
|
71
98
|
### Registering Commands
|
|
72
99
|
|
|
73
100
|
```typescript
|
package/docs/interactive-mode.md
CHANGED
|
@@ -56,6 +56,7 @@ iosm --continue
|
|
|
56
56
|
| `/semantic` | Open semantic search manager (`setup/auto-index/status/index/rebuild/query`) | `/semantic` |
|
|
57
57
|
| `/contract` | Interactive engineering contract editor (field-by-field, auto JSON build) | `/contract` |
|
|
58
58
|
| `/singular` | Feature feasibility analyzer with implementation options and recommendation | `/singular add account dashboard` |
|
|
59
|
+
| `/ultrathink` | Deep multi-iteration read-only analysis mode with self-check checkpoints | `/ultrathink -q 7 investigate auth regression` |
|
|
59
60
|
| `/swarm` | Recommended multi-agent orchestration runtime for complex/risky tasks (`run`, `from-singular`, `watch`, `retry`, `resume`) | `/swarm run refactor auth module --max-parallel 3` |
|
|
60
61
|
| `/memory` | Interactive memory manager (`add/edit/remove/scope/path`) | `/memory` |
|
|
61
62
|
| `/settings` | View/modify settings | `/settings` |
|
|
@@ -82,6 +83,7 @@ iosm --continue
|
|
|
82
83
|
| `/agents` | Inspect custom/system agents | `/agents` |
|
|
83
84
|
| `/subagent-runs` | List subagent run history | `/subagent-runs` |
|
|
84
85
|
| `/subagent-resume` | Resume a subagent run | `/subagent-resume run-123` |
|
|
86
|
+
| `/bg` | Background shell process manager (`list/status/logs/stop`) | `/bg status bg_...` |
|
|
85
87
|
| `/team-runs` | List team orchestration runs | `/team-runs` |
|
|
86
88
|
| `/team-status` | Check team run status | `/team-status team-456` |
|
|
87
89
|
|
|
@@ -109,11 +111,16 @@ In `/semantic setup`, the headers step is optional: press `Enter` on empty input
|
|
|
109
111
|
`/memory` opens an interactive manager. `/memory <text>` saves a note to `memory.md` and reloads session context. Use `/memory edit <index> <text>` for direct updates.
|
|
110
112
|
`/contract` edits contract fields interactively (`goal`, scope, constraints, quality gates, DoD, risks, etc.), then writes JSON automatically.
|
|
111
113
|
`/singular <request>` runs a two-pass feasibility analysis (baseline scan + standard agent pass), builds concrete implementation options, then prompts `Start with Swarm` / `Continue without Swarm` / `Cancel`.
|
|
114
|
+
`/ultrathink [-q N|--iterations N] [query]` runs `N` root-agent analysis passes in strict read-only mode (`N` defaults to `5`, max `12`), carries a compact checkpoint between passes, and emits concise per-iteration summaries with a final synthesis.
|
|
115
|
+
`/ultrathink` without query reuses the latest meaningful user request from session context.
|
|
116
|
+
If early passes produce no tool evidence, ultrathink injects an internal grounding retry so the agent probes the workspace with read-only tools before continuing.
|
|
117
|
+
Run detached shell jobs with `! <command> &` (example: `! npm run dev &`) and manage them using `/bg`, `/bg status <id>`, `/bg logs <id> [lines]`, `/bg stop <id>`.
|
|
112
118
|
`/swarm` enforces `Scopes -> Touches -> Locks -> Gates -> Done`. If effective contract is missing, it blocks execution and opens a bootstrap menu (auto-draft, guided Q&A, or manual `/contract` editor).
|
|
113
119
|
`/orchestrate --parallel` defaults `--max-parallel` to `--agents` when omitted and auto-selects `meta` workers when profiles are not explicitly set (outside read-only host contexts).
|
|
114
120
|
For orchestrate assignments, `delegate_parallel_hint` is carried into child task calls; high hints should trigger nested delegate fan-out or explicit `DELEGATION_IMPOSSIBLE`.
|
|
115
121
|
If a model emits raw pseudo markup like `<tool_call>`, `<function=...>`, or `<delegate_task>` instead of real tool calls, interactive mode injects bounded protocol-recovery retries.
|
|
116
122
|
If a model returns a silent `stop` (no visible text and no tool call), interactive mode injects bounded stall-recovery retries.
|
|
123
|
+
After `/compact`, compaction summaries carry a continuation hint to proceed from current state without repeating a full recap unless user explicitly asks.
|
|
117
124
|
`/blast` and `/shadow` are removed from active interactive workflow.
|
|
118
125
|
|
|
119
126
|
### `/contract` Detailed Guide
|
|
@@ -165,6 +165,11 @@ Create markdown files in `.iosm/agents/`:
|
|
|
165
165
|
---
|
|
166
166
|
name: security-auditor
|
|
167
167
|
description: Specialized security vulnerability analysis
|
|
168
|
+
tools:
|
|
169
|
+
- read
|
|
170
|
+
- git-read
|
|
171
|
+
disallowed_tools:
|
|
172
|
+
- write
|
|
168
173
|
---
|
|
169
174
|
|
|
170
175
|
You are a security auditor specializing in web application security.
|
|
@@ -194,6 +199,17 @@ Always provide:
|
|
|
194
199
|
|
|
195
200
|
Built-in system agents remain available; inspect via `/agents`.
|
|
196
201
|
|
|
202
|
+
### Tool List Normalization in Agent Frontmatter
|
|
203
|
+
|
|
204
|
+
For custom agent frontmatter fields `tools` and `disallowed_tools`, runtime applies compatibility normalization:
|
|
205
|
+
|
|
206
|
+
- trims whitespace
|
|
207
|
+
- lowercases names
|
|
208
|
+
- converts `-` to `_` (for example `git-read` -> `git_read`)
|
|
209
|
+
- drops unknown tool names and records diagnostics
|
|
210
|
+
|
|
211
|
+
This keeps old/frontmatter variants compatible while preventing invalid tool names from breaking delegation.
|
|
212
|
+
|
|
197
213
|
---
|
|
198
214
|
|
|
199
215
|
## Safety Guidance
|
package/docs/rpc-json-sdk.md
CHANGED
|
@@ -129,6 +129,20 @@ agent.stdout.on("data", (data) => {
|
|
|
129
129
|
});
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
### Detached Bash via Tool Parameters
|
|
133
|
+
|
|
134
|
+
When the `bash` tool is available, callers can request detached execution with `run_in_background: true`.
|
|
135
|
+
The result details include `backgroundTaskId` plus paths to metadata/log files.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const result = await bashTool.execute("bg-1", {
|
|
139
|
+
command: "npm run dev",
|
|
140
|
+
run_in_background: true,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
console.log(result.details?.backgroundTaskId);
|
|
144
|
+
```
|
|
145
|
+
|
|
132
146
|
### RPC Extension UI
|
|
133
147
|
|
|
134
148
|
Extensions can expose UI elements through RPC mode. See [rpc-extension-ui.ts](../examples/rpc-extension-ui.ts) for a complete example of using `confirm`, `select`, `notify`, and other UI methods over RPC.
|
|
@@ -129,12 +129,19 @@ Traces are stored as `<session-id>.jsonl` files. Each line is a JSON event:
|
|
|
129
129
|
```jsonl
|
|
130
130
|
{"type":"session_start","timestamp":"2026-03-09T15:42:00Z","sessionId":"abc123"}
|
|
131
131
|
{"type":"user_message","timestamp":"2026-03-09T15:42:05Z","content":"Analyze the project"}
|
|
132
|
+
{"type":"system_prompt_context_compose","timestamp":"2026-03-09T15:42:05Z","context_before_chars":16422,"context_after_chars":11998,"dedupe_hits":2,"truncated_files":["README.md"],"dropped_files":1}
|
|
132
133
|
{"type":"tool_call","timestamp":"2026-03-09T15:42:06Z","tool":"ls","input":{"path":"."}}
|
|
133
134
|
{"type":"tool_result","timestamp":"2026-03-09T15:42:06Z","tool":"ls","output":"..."}
|
|
135
|
+
{"type":"bash_end","timestamp":"2026-03-09T15:42:07Z","command":"npm run dev","backgroundTaskId":"bg_1770000000000_ab12cd34"}
|
|
134
136
|
{"type":"assistant_message","timestamp":"2026-03-09T15:42:10Z","content":"Here's my analysis..."}
|
|
135
137
|
{"type":"turn_end","timestamp":"2026-03-09T15:42:10Z","usage":{"totalTokens":1500}}
|
|
136
138
|
```
|
|
137
139
|
|
|
140
|
+
Notable runtime events:
|
|
141
|
+
|
|
142
|
+
- `system_prompt_context_compose` shows prompt-context preprocessing stats (before/after chars, dedupe hits, truncation, dropped files).
|
|
143
|
+
- `bash_end.backgroundTaskId` is populated when a shell command was started in detached background mode.
|
|
144
|
+
|
|
138
145
|
### Analyzing Traces
|
|
139
146
|
|
|
140
147
|
```bash
|