You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Clawform executes agentic programs from markdown files.
4
4
5
-
You keep instructions in repo files and run `cf -f program.md` (equivalent to `cf apply -f program.md`). Each run uses `.clawform/agent_*.json|md` protocol files, writes session data under `.clawform/programs/<program_id>/sessions/<session_id>/`, and appends `.clawform/history/index.jsonl`.
5
+
You keep instructions in repo files and run `cf -f program.md` (equivalent to `cf apply -f program.md`). Each run writes session data under `.clawform/programs/<program_id>/sessions/<session_id>/` and appends `.clawform/history/index.jsonl`.
6
6
7
7
## Why It Exists
8
8
@@ -34,13 +34,13 @@ Before execution, Clawform previews:
34
34
35
35
Then it asks for confirmation and executes the program with the configured provider.
36
36
37
-
During execution, Clawform streams agent progress events to the terminal and writes per-session `commands/*` and `messages/*` files for clickable `out`/`msg` links.
37
+
During execution, Clawform streams progress events to the terminal.
38
38
39
39
After execution, Clawform stores:
40
40
41
41
- run outcome and summary (`outcome.json`, `output.md`)
42
42
- per-session snapshots for next-run diff (`program.md`, `variables.json`)
43
-
- changed files reported for this session (from `agent_outputs.json`)
@@ -116,6 +117,8 @@ Clawform keeps local state under `.clawform/`:
116
117
117
118
Session folders keep `program.md`, `variables.json`, `output.md`, `outcome.json`, plus `commands/*` and `messages/*` used by interactive `out`/`msg` links.
118
119
120
+
For internal protocol details and strict agent result schema, see `contrib/ARCHITECTURE.md`.
Copy file name to clipboardExpand all lines: contrib/ARCHITECTURE.md
+51-11Lines changed: 51 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,13 +87,15 @@ Variable rules:
87
87
- program diff vs last session snapshot (if available)
88
88
- variable diff vs last session variable snapshot (if available)
89
89
5. Ask for confirmation (interactive default; skipped by `--yes`).
90
-
6. Write runtime variables file (`.clawform/agent_variables.json`) when variables are present.
91
-
7. Run provider in the current workspace (no temp workspace copy).
92
-
8. Stream provider events to terminal; during the run write session `commands/*` and `messages/*` for clickable `out`/`msg` links.
93
-
9. Read agent status from `.clawform/agent_result.json` (required).
94
-
10. Collect reported changed files from `.clawform/agent_outputs.json` when that file exists and was updated in this run.
95
-
11. Persist run-end records (`output.md`, `outcome.json`) and append `.clawform/history/index.jsonl`.
96
-
12. Persist program snapshot (`program.md`) and variable snapshot (`variables.json`) on success.
90
+
6. Clear prior run protocol files in `.clawform/` and write runtime variables file (`.clawform/agent_variables.json`) when variables are present.
91
+
7. Build runtime prompt; in sandboxed modes (`sandboxed`/`auto`) include explicit verdict-gate rules for sandbox-vs-program blocking.
92
+
8. Run provider in the current workspace (no temp workspace copy).
93
+
9. Stream provider events to terminal; during the run write session `commands/*` and `messages/*`.
94
+
10. In `auto` sandbox mode, allow at most one unsandboxed retry only when current-run `.clawform/agent_result.json` reports `status=partial|failure` and `reason=sandbox_blocked` (no stdout/stderr heuristic fallback).
95
+
11. Read agent status from `.clawform/agent_result.json` (required) and validate strict status/reason schema.
96
+
12. Collect reported changed files from `.clawform/agent_outputs.json` when that file exists and was updated in this run.
97
+
13. Persist run-end records (`output.md`, `outcome.json`) and append `.clawform/history/index.jsonl`.
98
+
14. Persist program snapshot (`program.md`) and variable snapshot (`variables.json`) on success.
97
99
98
100
## 5) State and Storage Layout
99
101
@@ -119,7 +121,7 @@ Path aliases used in this section:
119
121
During the current run:
120
122
121
123
- Write `<protocol_root>/agent_variables.json` (when variables exist); the agent reads this file for resolved `${{ var.NAME }}` values.
122
-
- Write `<session_root>/commands/*` and `<session_root>/messages/*`for clickable `out`/`msg` links in live progress output.
124
+
- Write `<session_root>/commands/*` and `<session_root>/messages/*`as per-session execution artifacts.
123
125
- Read `<protocol_root>/agent_result.json`, `<protocol_root>/agent_outputs.json`, and optional `<protocol_root>/agent_output.md` at run end to determine status, changed files, and summary.
124
126
125
127
On the next run of the same program:
@@ -138,11 +140,11 @@ For audit/debug visibility:
138
140
| Data path | Scope | Why we store it | When it is used |
139
141
|---|---|---|---|
140
142
|`<protocol_root>/agent_variables.json`| Workspace-global scratch file for the currently running apply (overwritten on each apply) | Provide resolved runtime variables to the agent | Read by the agent during that same apply run |
141
-
|`<protocol_root>/agent_result.json`| Workspace-global scratch file for the currently running apply (overwritten on each apply) | Receive final structured run status (`success/partial/failure`) and short reason/message from the agent | Read by Clawform at run end (and sandbox-retry logic), only if file mtime is from this run |
143
+
|`<protocol_root>/agent_result.json`| Workspace-global scratch file for the currently running apply (overwritten on each apply) | Receive final structured run verdict (`status`, optional `reason`, `message`) where `reason` is strict enum (`sandbox_blocked` or `program_blocked`) | Read by Clawform at run end; in sandbox auto mode also used as the only retry signal source, only if file mtime is from this run |
142
144
|`<protocol_root>/agent_outputs.json`| Workspace-global scratch file for the currently running apply (overwritten on each apply) | Receive changed-file list from the agent | Read by Clawform at run end for file summary/history, only if file mtime is from this run |
143
145
|`<protocol_root>/agent_output.md`| Workspace-global scratch file for the currently running apply (optional; overwritten on each apply) | Receive agent-written summary text | Read by Clawform at run end; then copied into session `output.md`|
144
-
|`<session_root>/commands/*.txt`| Per-session (`<program_id>/<session_id>`) | Preserve command output behind clickable `out` links| Used immediately in terminal progress output|
145
-
|`<session_root>/messages/*.md`| Per-session (`<program_id>/<session_id>`) | Preserve assistant/message output behind clickable `msg` links | Used immediately in terminal progress output; also fallback summary source |
146
+
|`<session_root>/commands/*.txt`| Per-session (`<program_id>/<session_id>`) | Preserve command output artifacts for this session| Used for progress drilldown and debugging|
147
+
|`<session_root>/messages/*.md`| Per-session (`<program_id>/<session_id>`) | Preserve assistant/message artifacts for this session | Used for progress drilldown and fallback summary source |
146
148
|`<session_root>/output.md`| Per-session (`<program_id>/<session_id>`) | Store stable summary artifact for this session | Used on next run of same `program_id` for preview/prompt reference |
147
149
|`<session_root>/program.md`| Per-session (`<program_id>/<session_id>`) | Snapshot program text that produced this session | Used on next run of same `program_id` to compute program diff |
148
150
|`<session_root>/variables.json`| Per-session (`<program_id>/<session_id>`) | Snapshot resolved variables for this session | Used on next run of same `program_id` to compute variables diff |
@@ -153,6 +155,7 @@ Compatibility behavior:
153
155
154
156
- No read fallback is used for `agent_summary.md` or `events.ndjson`.
155
157
- Current apply reads only the current protocol files documented in this section.
158
+
- Sandbox auto-retry does not parse provider stdout/stderr for sandbox heuristics; it only trusts current-run `agent_result.json`.
156
159
157
160
Current limitation:
158
161
@@ -169,6 +172,43 @@ Current apply does not persist:
0 commit comments