archal 0.9.20 → 0.10.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/README.md +59 -159
- package/agents/openclaw/Dockerfile +2 -1
- package/agents/openclaw/README.md +10 -17
- package/agents/openclaw/drive.mjs +21 -31
- package/agents/openclaw/extract-openclaw-response-text.mjs +49 -0
- package/agents/openclaw/scenarios/acceptance/github-escalation-and-cleanup.md +43 -0
- package/agents/openclaw/scenarios/acceptance/jira-linear-release-triage.md +39 -0
- package/agents/openclaw/scenarios/acceptance/multi-clone-customer-risk-review.md +45 -0
- package/agents/openclaw/scenarios/acceptance/slack-incident-handoff.md +42 -0
- package/agents/openclaw/scenarios/acceptance/stripe-dunning-remediation.md +40 -0
- package/agents/openclaw/scenarios/close-stale-issues.md +35 -0
- package/agents/openclaw/workspace/TOOLS.md +19 -0
- package/clone-assets/calcom/tools.json +1705 -153
- package/clone-assets/clickup/tools.json +2528 -541
- package/clone-assets/customerio/tools.json +2108 -144
- package/clone-assets/github/tools.json +1 -2
- package/clone-assets/gitlab/tools.json +10087 -398
- package/clone-assets/hubspot/tools.json +198 -0
- package/clone-assets/linear/tools.json +41 -1
- package/clone-assets/sentry/tools.json +2264 -188
- package/clone-assets/stripe/tools.json +114 -0
- package/clone-assets/webflow/tools.json +1895 -125
- package/dist/{autoloop-worker-types-BEb_E44z.d.cts → autoloop-worker-types-CHaclqtD.d.cts} +23 -59
- package/dist/cli.cjs +107175 -126959
- package/dist/commands/{autoloop-hosted-worker.cjs → autoloop-hosted-control-plane-client.cjs} +25657 -42736
- package/dist/commands/{autoloop-hosted-worker.d.cts → autoloop-hosted-control-plane-client.d.cts} +32 -42
- package/dist/commands/autoloop-pr-verification.cjs +607 -522
- package/dist/commands/autoloop-pr-verification.d.cts +3 -1
- package/dist/commands/autoloop-result-parser.cjs +2474 -2373
- package/dist/commands/autoloop-result-parser.d.cts +159 -2
- package/dist/commands/autoloop-worker.cjs +14565 -12240
- package/dist/commands/autoloop-worker.d.cts +10 -5
- package/dist/eval-shim.mjs +216 -0
- package/dist/index.cjs +15 -2
- package/dist/index.d.cts +3 -1
- package/dist/layer-1-ziaLpfLr.d.cts +62 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/reporter-entry.js +3 -0
- package/dist/{replay.cjs → sdk/index.cjs} +42979 -40973
- package/dist/sdk/index.d.cts +626 -0
- package/dist/vitest/{chunk-6CBYFCFK.js → chunk-2PDHTPZC.js} +289 -89
- package/dist/vitest/{chunk-ARVS45PP.js → chunk-7L4BBB6M.js} +123 -274
- package/dist/vitest/index.cjs +500 -816
- package/dist/vitest/index.d.ts +16 -81
- package/dist/vitest/index.js +40 -409
- package/dist/vitest/runtime/hosted-session-reaper.cjs +143 -293
- package/dist/vitest/runtime/hosted-session-reaper.js +1 -1
- package/dist/vitest/runtime/setup-files.js +2 -2
- package/manifest.json +9 -0
- package/package.json +14 -13
- package/skills/archal-agent/SKILL.md +0 -1
- package/skills/autoloop/SKILL.md +288 -273
- package/skills/autoloop/references/hosted-sources.md +49 -17
- package/skills/autoloop/references/trace-schema-mapping.md +83 -52
- package/skills/eval/SKILL.md +16 -48
- package/skills/free-account/SKILL.md +103 -0
- package/skills/install-agent/SKILL.md +16 -35
- package/skills/onboard/SKILL.md +13 -70
- package/skills/scenario/SKILL.md +30 -27
- package/skills/seed/SKILL.md +7 -6
- package/skills/vitest/SKILL.md +3 -2
- package/agents/github-octokit/.archal.json +0 -8
- package/agents/github-octokit/Dockerfile +0 -8
- package/agents/github-octokit/README.md +0 -113
- package/agents/github-octokit/agent.mjs +0 -54
- package/agents/github-octokit/package.json +0 -9
- package/agents/github-octokit/scenarios/test-repo-access.md +0 -27
- package/agents/google-workspace-local-tools/Dockerfile +0 -6
- package/agents/google-workspace-local-tools/README.md +0 -58
- package/agents/google-workspace-local-tools/agent.mjs +0 -196
- package/agents/google-workspace-local-tools/archal-harness.json +0 -7
- package/agents/google-workspace-local-tools/run-input.yaml +0 -16
- package/agents/google-workspace-local-tools/scenario.md +0 -29
- package/agents/hermes/.archal.json +0 -8
- package/agents/hermes/Dockerfile +0 -46
- package/agents/hermes/README.md +0 -87
- package/agents/hermes/SOUL.md +0 -27
- package/agents/hermes/config.yaml +0 -34
- package/agents/hermes/drive.mjs +0 -113
- package/agents/hermes/scenarios/stripe-customers-read-only.md +0 -32
- package/agents/pagination-test/README.md +0 -24
- package/agents/pagination-test/scenario.md +0 -24
- package/agents/replay-capsule-harness/README.md +0 -29
- package/agents/replay-capsule-harness/observability-install-offline-e2e.mts +0 -1517
- package/agents/replay-capsule-harness/replay-capsule-e2e.mjs +0 -104
- package/dist/harness.cjs +0 -63
- package/dist/harness.d.cts +0 -20
- package/dist/replay.d.cts +0 -4625
- package/dist/scenarios.cjs +0 -80343
- package/dist/scenarios.d.cts +0 -562
package/skills/autoloop/SKILL.md
CHANGED
|
@@ -7,12 +7,13 @@ argument-hint: "[repo, trace source, or failure description]"
|
|
|
7
7
|
|
|
8
8
|
# Archal Autoloop
|
|
9
9
|
|
|
10
|
-
You help users connect real agent traces to Archal
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
You help users connect real agent traces to Archal, then drive the loop that
|
|
11
|
+
turns a production failure into a verified reproduction and, when the user
|
|
12
|
+
opts in, a fix PR. Your job is to wire the repo, trace source, harness, and
|
|
13
|
+
scenario without guessing or leaking secrets.
|
|
13
14
|
|
|
14
|
-
Autoloop is not a replacement for `archal run`. It uses the same harness and
|
|
15
|
-
routing
|
|
15
|
+
Autoloop is not a replacement for `archal run`. It uses the same harness and
|
|
16
|
+
clone routing, but the trigger is a trace that already happened.
|
|
16
17
|
|
|
17
18
|
Autoloop is also not arbitrary production trace replay. It can reproduce a
|
|
18
19
|
failure only when the trace, scenario contract, and seed templates contain
|
|
@@ -21,331 +22,351 @@ is thin, block and name the missing data instead of claiming reproduction.
|
|
|
21
22
|
|
|
22
23
|
## Product mental model
|
|
23
24
|
|
|
24
|
-
Autoloop
|
|
25
|
+
Autoloop runs this loop:
|
|
25
26
|
|
|
26
27
|
1. Import a trace and its child spans from a read-only source.
|
|
27
28
|
2. Grade whether the trace contains a real failure.
|
|
28
29
|
3. Build a reproduction scenario and clone seed from trace evidence plus
|
|
29
30
|
repo-owned seed templates.
|
|
30
31
|
4. Run the reproduction against service clones through the customer harness.
|
|
31
|
-
5. If reproduced, patch the repo and open a GitHub
|
|
32
|
+
5. If reproduced, patch the repo and open a GitHub PR.
|
|
32
33
|
|
|
33
34
|
Steps 1-4 are **autoloop**: ingest -> grade -> find the failed trace ->
|
|
34
35
|
reproduce on clones. Step 5 (writing the fix and opening the PR) is **autofix**,
|
|
35
36
|
a separate opt-in step that is *not* part of autoloop until it is turned on.
|
|
36
|
-
Both are per-agent toggles, switchable from the agents tab, the CLI, or by asking
|
|
37
|
-
the Archal copilot in chat.
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
only with autofix off, while `fix` turns autofix on (autoloop plus the fix/PR
|
|
41
|
-
step). Narrower policies stop earlier:
|
|
38
|
+
## Consent breakpoints (do these before you touch anything)
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| `fix` | PR or blocked fix status | on |
|
|
40
|
+
Autoloop can act on the user's real repository and reads their production
|
|
41
|
+
traces. Before you register a source or start a loop, walk the three
|
|
42
|
+
breakpoints below **in order**. Each is a hard STOP: ask the question, wait for
|
|
43
|
+
an explicit answer, and only then proceed. Do not batch them, do not assume a
|
|
44
|
+
default, and do not start the loop until all three are answered.
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
trace-replay commands. The public command is `archal autoloop`. Local stop
|
|
52
|
-
command is `archal detach` for file-backed trace directories.
|
|
46
|
+
### Breakpoint 1 - PR-opening consent
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
STOP. Before anything else, state the consequence plainly and ask the user to
|
|
49
|
+
choose:
|
|
55
50
|
|
|
56
|
-
|
|
51
|
+
> Autoloop can open fix PRs on your repo automatically. With **Autofix ON**,
|
|
52
|
+
> every imported production failure that reproduces gets a fix PR opened on
|
|
53
|
+
> your repo. With **Autofix OFF**, autoloop stops after reproducing the failure
|
|
54
|
+
> and opens no PRs; you (or your agent) take over from the reproduction.
|
|
55
|
+
> Which do you want?
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
pass?
|
|
60
|
-
2. Existing Archal files:
|
|
61
|
-
- `.archal.json`
|
|
62
|
-
- `.archal/harness.*`
|
|
63
|
-
- `archal/harness.json`
|
|
64
|
-
- `archal/scenario.md`
|
|
65
|
-
- `archal/run-input.yaml`
|
|
66
|
-
- `archal/seeds/*.json`
|
|
67
|
-
- `scenarios/*.md`
|
|
68
|
-
3. Service SDKs and likely clones:
|
|
69
|
-
- `stripe` -> `stripe`
|
|
70
|
-
- `@octokit/rest`, `octokit` -> `github`
|
|
71
|
-
- `@slack/web-api`, `@slack/bolt` -> `slack`
|
|
72
|
-
- `jira`, `jira-client`, `jira.js` -> `jira`
|
|
73
|
-
- `@linear/sdk` -> `linear`
|
|
74
|
-
- `@supabase/supabase-js`, `pg` -> `supabase`
|
|
75
|
-
- `googleapis` -> `google-workspace`
|
|
76
|
-
4. GitHub remote:
|
|
77
|
-
```bash
|
|
78
|
-
git remote get-url origin
|
|
79
|
-
```
|
|
80
|
-
Hosted sources and `--execution-policy fix` need a GitHub remote.
|
|
81
|
-
5. Trace source shape, if available:
|
|
82
|
-
- provider: local files, Postgres, Supabase
|
|
83
|
-
- or local/client-ingested sources normalized through `archal trace-source`
|
|
84
|
-
such as file, HTTP/OTel, Langfuse, Braintrust, S3/GCS, or custom JSON
|
|
85
|
-
- trace table and span table names
|
|
86
|
-
- id columns
|
|
87
|
-
- parent span column
|
|
88
|
-
- timestamp/cursor columns
|
|
89
|
-
- status, workspace, trace group, and agent filters
|
|
90
|
-
|
|
91
|
-
Never print secrets while inspecting. If you need to show a database URL, show
|
|
92
|
-
only the env var name or secret reference.
|
|
93
|
-
|
|
94
|
-
## Preconditions
|
|
95
|
-
|
|
96
|
-
You need these before a full hosted Autoloop setup:
|
|
97
|
-
|
|
98
|
-
- Archal CLI installed in the repo or reachable with `npx archal`
|
|
99
|
-
- authenticated user (`archal login`) or `ARCHAL_TOKEN=archal_ws_...`
|
|
100
|
-
- GitHub App installed on the target repo
|
|
101
|
-
- repo origin that resolves to `github.com/<owner>/<repo>`
|
|
102
|
-
- read-only trace source credential
|
|
103
|
-
- headless harness command
|
|
104
|
-
- `archal/scenario.md` for the trace family
|
|
105
|
-
- optional but strongly recommended `archal/seeds/*.json`
|
|
106
|
-
- model/provider keys required by the user's agent and tests
|
|
107
|
-
|
|
108
|
-
If any prerequisite is missing, make the smallest safe change and explain what
|
|
109
|
-
is still required. Do not continue into a fake reproduction.
|
|
110
|
-
|
|
111
|
-
## Safe setup flow
|
|
112
|
-
|
|
113
|
-
### 1. Install and authenticate
|
|
114
|
-
|
|
115
|
-
Prefer project-local install:
|
|
57
|
+
Map the answer explicitly and never rely on the CLI default:
|
|
116
58
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
```
|
|
59
|
+
| User wants | Pass | Autofix |
|
|
60
|
+
|------------|------|---------|
|
|
61
|
+
| Fix PRs opened automatically | `--execution-policy fix` | ON |
|
|
62
|
+
| Reproduce only, no PRs | `--execution-policy reproduce` | OFF |
|
|
122
63
|
|
|
123
|
-
|
|
64
|
+
The bare `archal autoloop` default is `fix`, which opens PRs. **Never let that
|
|
65
|
+
default stand in silently.** Always pass an explicit `--execution-policy` that
|
|
66
|
+
matches the user's answer. The reproduce-only promise is real: with
|
|
67
|
+
`--execution-policy reproduce`, autoloop grades and replays against clones and
|
|
68
|
+
then stops, with no fix and no PR.
|
|
124
69
|
|
|
125
|
-
|
|
126
|
-
export ARCHAL_TOKEN=archal_ws_...
|
|
127
|
-
npx archal usage
|
|
128
|
-
```
|
|
70
|
+
### Breakpoint 2 - GitHub App install (only if the user chose fix PRs)
|
|
129
71
|
|
|
130
|
-
|
|
72
|
+
If the user chose **reproduce only**, skip this breakpoint and note that the
|
|
73
|
+
fix path stays off.
|
|
131
74
|
|
|
132
|
-
|
|
75
|
+
If the user chose **fix PRs**, STOP and explain, then wait for confirmation:
|
|
133
76
|
|
|
134
|
-
|
|
77
|
+
> The fix-PR path needs the **Archal GitHub App** installed on the target repo
|
|
78
|
+
> and linked to your Archal workspace. The app is granted least-privilege
|
|
79
|
+
> access: write to repository contents (to push a fix branch) and to pull
|
|
80
|
+
> requests (to open the PR), plus read-only access to Actions, checks, commit
|
|
81
|
+
> statuses, and metadata so it can watch its own PR's checks. It gets **no**
|
|
82
|
+
> issue access, and it opens a PR from a fix branch rather than pushing to your
|
|
83
|
+
> default branch. Install it from the Archal dashboard's integrations /
|
|
84
|
+
> connect-repo flow, then tell me once it is installed (or say you'd rather stay
|
|
85
|
+
> reproduce-only).
|
|
135
86
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"version": 1,
|
|
139
|
-
"local": {
|
|
140
|
-
"command": "node",
|
|
141
|
-
"args": ["agent.mjs"]
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
```
|
|
87
|
+
Do not proceed to a `fix` policy until the user confirms. Verify the install
|
|
88
|
+
with the machine check before starting the loop:
|
|
145
89
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
print its final answer to stdout. If the project already has `.archal.json` for
|
|
150
|
-
`archal run`, align the Autoloop harness with that command.
|
|
90
|
+
```bash
|
|
91
|
+
npx archal autoloop --repo . --execution-policy fix --check --json
|
|
92
|
+
```
|
|
151
93
|
|
|
152
|
-
|
|
94
|
+
The `GitHub App auth` check must pass (a repo-scoped PR token can be minted). A
|
|
95
|
+
failing check tells you exactly what is missing; relay that, don't guess.
|
|
153
96
|
|
|
154
|
-
|
|
97
|
+
### Breakpoint 3 - read-only database connection string
|
|
155
98
|
|
|
156
|
-
|
|
99
|
+
STOP whenever the trace source is a database (Postgres or Supabase). Do not
|
|
100
|
+
accept a privileged or default connection string. Walk the user through
|
|
101
|
+
creating a **read-only** role scoped to the trace tables, then:
|
|
157
102
|
|
|
158
|
-
|
|
159
|
-
|
|
103
|
+
- The credential is passed by **environment variable name**, not value:
|
|
104
|
+
`--database-url-env <ENV_VAR_NAME>`. Never put the URL inline in a command,
|
|
105
|
+
never echo it, never commit it.
|
|
106
|
+
- In hosted production, prefer a secret reference:
|
|
107
|
+
`--database-url-secret-ref <ref>` (the ref must not contain a plaintext
|
|
108
|
+
credential).
|
|
160
109
|
|
|
161
|
-
|
|
162
|
-
|
|
110
|
+
Ask the user to confirm the role is read-only and the URL lives in an env var
|
|
111
|
+
or secret ref before you run any `--source` command. See
|
|
112
|
+
`references/hosted-sources.md` for the read-only-role and flag detail.
|
|
163
113
|
|
|
164
|
-
##
|
|
165
|
-
The task the agent should complete.
|
|
114
|
+
## Discover first
|
|
166
115
|
|
|
167
|
-
|
|
168
|
-
The answer key for grading and reproduction.
|
|
116
|
+
Before changing anything, inspect the repo:
|
|
169
117
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
118
|
+
1. `package.json` and scripts: how is the agent run? What tests should a fix PR
|
|
119
|
+
pass?
|
|
120
|
+
2. Auth: `archal usage` must pass. For hosted sources, CI, or headless agents,
|
|
121
|
+
use a workspace API key in `ARCHAL_TOKEN`, created by an owner/admin with
|
|
122
|
+
`archal workspace api-key create <label>`.
|
|
123
|
+
3. GitHub remote: `git remote get-url origin`. Hosted sources and the `fix`
|
|
124
|
+
policy need an origin that resolves to `github.com/<owner>/<repo>`.
|
|
125
|
+
4. Docker: high-fidelity reproduction needs Docker or sandbox mode available.
|
|
126
|
+
If Docker is unavailable, stop before claiming clone-backed reproduction.
|
|
127
|
+
5. Existing Archal files: `.archal.json`, `archal/harness.json`,
|
|
128
|
+
`archal/scenario.md`, `archal/seeds/*.json`, `scenarios/*.md`.
|
|
129
|
+
6. Service SDKs and likely clones: `stripe` -> `stripe`; `@octokit/rest`,
|
|
130
|
+
`octokit` -> `github`; `@slack/web-api`, `@slack/bolt` -> `slack`;
|
|
131
|
+
`jira.js` -> `jira`; `@linear/sdk` -> `linear`; `@supabase/supabase-js`,
|
|
132
|
+
`pg` -> `supabase`; `googleapis` -> `google-workspace`.
|
|
133
|
+
7. Trace source shape: provider (local files, Postgres, Supabase), trace/span
|
|
134
|
+
table names, id columns, parent-span column, cursor columns, and any
|
|
135
|
+
workspace/agent/status/group filters.
|
|
136
|
+
|
|
137
|
+
Never print secrets while inspecting. Show only the env var name or secret
|
|
138
|
+
reference, never a database URL.
|
|
139
|
+
|
|
140
|
+
## Setup files
|
|
141
|
+
|
|
142
|
+
### `archal/harness.json`
|
|
173
143
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
timeout: 120
|
|
144
|
+
```json
|
|
145
|
+
{ "version": 1, "local": { "command": "node", "args": ["agent.mjs"] } }
|
|
177
146
|
```
|
|
178
147
|
|
|
179
|
-
|
|
180
|
-
|
|
148
|
+
The command must be headless and repeatable, and run the real agent path (not a
|
|
149
|
+
mock). During reproduction Archal invokes it through `archal run`, so the agent
|
|
150
|
+
reads its task from `AGENT_TASK` and prints its final answer to stdout. Align it
|
|
151
|
+
with the `agent` command in `.archal.json` if one exists.
|
|
181
152
|
|
|
182
|
-
###
|
|
153
|
+
### `archal/scenario.md`
|
|
183
154
|
|
|
184
|
-
|
|
155
|
+
Describes the standing task and checks for this trace family. Required sections:
|
|
156
|
+
`# Title`, `## Setup`, `## Prompt`, `## Expected Behavior`,
|
|
157
|
+
`## Success Criteria` (`[D]` deterministic, `[P]` probabilistic), `## Config`
|
|
158
|
+
(`clones:`, `timeout:`). Keep model-visible instructions realistic: do not tell
|
|
159
|
+
the tested agent it is in Archal, a clone-backed environment, or a replay.
|
|
185
160
|
|
|
186
|
-
|
|
187
|
-
archal/seeds/
|
|
188
|
-
stripe-billing-support.json
|
|
189
|
-
jira-escalations.json
|
|
190
|
-
```
|
|
161
|
+
### Seed templates (when trace evidence is thin)
|
|
191
162
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
weak
|
|
163
|
+
Put stable service state for the task family under `archal/seeds/*.json` (e.g.
|
|
164
|
+
`stripe-billing-support.json`). Autoloop fills in trace-specific identifiers.
|
|
165
|
+
This is far safer than expecting a weak trace to reconstruct full service state.
|
|
195
166
|
|
|
196
|
-
##
|
|
167
|
+
## Register the loop
|
|
197
168
|
|
|
198
|
-
|
|
199
|
-
keep the URL in `TRACE_DATABASE_URL` (or a secret ref in hosted production), then
|
|
200
|
-
`--check` the source and re-run without `--check` to register it. Registration
|
|
201
|
-
posts the source config to Archal and returns; hosted workers own polling after
|
|
202
|
-
that, so local `archal detach` does not disable it.
|
|
169
|
+
### Local trace directory (pilot / exported files)
|
|
203
170
|
|
|
204
|
-
|
|
205
|
-
|
|
171
|
+
```bash
|
|
172
|
+
npx archal autoloop ./prod-traces --repo . --execution-policy reproduce
|
|
173
|
+
```
|
|
206
174
|
|
|
207
|
-
|
|
175
|
+
Uses the policy from Breakpoint 1. Artifacts land under `.archal/autoloop/`
|
|
176
|
+
(see the artifact guide below). Stop it with
|
|
177
|
+
`npx archal autoloop detach ./prod-traces --repo .`.
|
|
208
178
|
|
|
209
|
-
|
|
210
|
-
Supabase table. This command normalizes source-specific payloads into Archal
|
|
211
|
-
trace upload envelopes, writes them to a trace directory, and can upload them to
|
|
212
|
-
hosted Autoloop when workspace auth is available.
|
|
179
|
+
### Hosted database source (Postgres / Supabase)
|
|
213
180
|
|
|
214
|
-
|
|
181
|
+
The source identity, schema mapping, cursor, and filters live in the
|
|
182
|
+
`.archal.json` `autoloop` block, not in flags. The starter takes only `--repo`,
|
|
183
|
+
`--source`, the credential (`--database-url-env` or `--database-url-secret-ref`),
|
|
184
|
+
`--execution-policy`, `--check`, and `--json`. A minimal config names the source:
|
|
215
185
|
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
--out .archal/traces/inbox
|
|
224
|
-
npx archal trace-source test langfuse
|
|
225
|
-
npx archal trace-source sync langfuse --upload --repository owner/repo
|
|
226
|
-
npx archal trace-source watch langfuse --upload --repository owner/repo
|
|
227
|
-
|
|
228
|
-
npx archal trace-source connect custom --name "prod exporter" --out .archal/traces/inbox
|
|
229
|
-
npx archal trace-source serve "prod exporter" --port 4319
|
|
186
|
+
```jsonc
|
|
187
|
+
// .archal.json
|
|
188
|
+
{
|
|
189
|
+
"autoloop": {
|
|
190
|
+
"source": { "name": "prod-agent-traces" }
|
|
191
|
+
}
|
|
192
|
+
}
|
|
230
193
|
```
|
|
231
194
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
195
|
+
Check first, then register (drop `--check` to register). Registration posts the
|
|
196
|
+
source config to Archal and returns; hosted workers own polling after that, so
|
|
197
|
+
`autoloop detach` does not disable a hosted source.
|
|
235
198
|
|
|
236
|
-
|
|
199
|
+
```bash
|
|
200
|
+
npx archal autoloop --repo . --source supabase \
|
|
201
|
+
--database-url-env TRACE_DATABASE_URL \
|
|
202
|
+
--execution-policy reproduce --check --json
|
|
203
|
+
```
|
|
237
204
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
and use `--source-*` filters to scope noisy sources by workspace, agent, status,
|
|
243
|
-
trace group, or limit.
|
|
205
|
+
See `references/hosted-sources.md` for the read-only-role and secret-ref detail,
|
|
206
|
+
and `references/trace-schema-mapping.md` when the customer's tables differ from
|
|
207
|
+
the `ai_traces` / `ai_spans` defaults (custom columns, append-only cursor mode,
|
|
208
|
+
and source filters). Both are configured under `autoloop.source` in `.archal.json`.
|
|
244
209
|
|
|
245
|
-
|
|
246
|
-
custom-schema, append-only, and filter flag blocks.
|
|
210
|
+
### Client-side ingestion (traces not already in a hosted table)
|
|
247
211
|
|
|
248
|
-
|
|
212
|
+
For traces not in a hosted Postgres/Supabase table, use the dashboard OTLP
|
|
213
|
+
endpoint or drop normalized JSON files into an autoloop watch directory:
|
|
249
214
|
|
|
250
|
-
|
|
215
|
+
- **Dashboard OTLP** — point the vendor's OpenTelemetry exporter at the OTLP
|
|
216
|
+
URL shown in the dashboard. Works for Langfuse, Braintrust, OTel, and custom
|
|
217
|
+
HTTP sources. No CLI command required.
|
|
218
|
+
- **File drop** — place normalized Archal trace JSON files in the watch
|
|
219
|
+
directory and run `archal autoloop <trace-dir>`. The loop picks them up on
|
|
220
|
+
the next import cycle.
|
|
251
221
|
|
|
252
|
-
|
|
253
|
-
npx archal autoloop ./prod-traces --repo . --execution-policy reproduce
|
|
254
|
-
```
|
|
222
|
+
## Policy semantics
|
|
255
223
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
```text
|
|
259
|
-
.archal/autoloop/
|
|
260
|
-
autoloops.json
|
|
261
|
-
runs.jsonl
|
|
262
|
-
raw/
|
|
263
|
-
grades/
|
|
264
|
-
seeds/
|
|
265
|
-
runs/
|
|
266
|
-
fixes/
|
|
267
|
-
failed/
|
|
268
|
-
logs/
|
|
269
|
-
```
|
|
224
|
+
Two independent toggles, both per-agent and switchable from the agents tab, the
|
|
225
|
+
CLI, or the Archal copilot:
|
|
270
226
|
|
|
271
|
-
|
|
227
|
+
- **Autoloop toggle** - whether the loop runs at all (import -> grade ->
|
|
228
|
+
reproduce). Off means no traces are processed.
|
|
229
|
+
- **Autofix toggle** - whether the fix / PR phase runs. ON maps to
|
|
230
|
+
`--execution-policy fix`; OFF maps to `--execution-policy reproduce`.
|
|
272
231
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
232
|
+
`--execution-policy` stops the loop at a phase; narrower policies stop earlier:
|
|
233
|
+
|
|
234
|
+
| Policy | Stops after | Autofix |
|
|
235
|
+
|--------|-------------|---------|
|
|
236
|
+
| `observe` | import | off |
|
|
237
|
+
| `grade` | grading | off |
|
|
238
|
+
| `seed` | seeding | off |
|
|
239
|
+
| `reproduce` | reproduction | off |
|
|
240
|
+
| `fix` | PR or blocked fix status | on |
|
|
276
241
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
for
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
242
|
+
Policy is **pinned at import time**. Flipping a toggle affects future imports
|
|
243
|
+
and retries, not runs that already imported under the old policy.
|
|
244
|
+
|
|
245
|
+
## CLI surface
|
|
246
|
+
|
|
247
|
+
Machine-readable, CLI only. Every command takes `--json` for scripting. Do not
|
|
248
|
+
call raw REST endpoints or dashboard URLs.
|
|
249
|
+
|
|
250
|
+
The starter flags are deliberately narrow: `--repo`, `--source`,
|
|
251
|
+
`--database-url-env`, `--database-url-secret-ref`, `--execution-policy`,
|
|
252
|
+
`--check`, and `--json`. Everything about the source itself — its name/id, schema
|
|
253
|
+
mapping, cursor mode and watermarks, filters, metadata, and regression scenarios export —
|
|
254
|
+
lives in the `.archal.json` `autoloop` block, not in flags. A retired flag now
|
|
255
|
+
exits `2` with a message naming the config field to set instead.
|
|
256
|
+
|
|
257
|
+
- `archal autoloop [trace-dir] --repo <repo> [--source postgres|supabase] [--execution-policy observe|grade|seed|reproduce|fix] [--check] [--json]`
|
|
258
|
+
starts a local file-backed loop or registers a hosted source.
|
|
259
|
+
- `--check --json` emits `{ ok, checks[], nextStep? }` and exits `2` when not
|
|
260
|
+
ready, `0` when ready. Read `checks[]` for the exact blocker.
|
|
261
|
+
- The starter (no `--check`) `--json` emits `{ ok, ... }` describing the
|
|
262
|
+
registered source or started loop.
|
|
263
|
+
- `archal autoloop status [run-id] [--json]` - without a run id: local ledger
|
|
264
|
+
status for each trace job. `--json` emits `{ ok, jobs[] }`; each row is a
|
|
265
|
+
trace-job summary (`traceId`, `status`, `currentPhase`, `action`,
|
|
266
|
+
`nextAction`, `attemptSummary`, `checkSummary`, `artifactSummary`,
|
|
267
|
+
`reference`, `stale`, `retryable`, `updatedAt`, plus raw ledger fields such
|
|
268
|
+
as `prUrl` and `error` when present). `--wait --until terminal|pr
|
|
269
|
+
--poll-interval <seconds> --wait-timeout <seconds>` polls for CI gates and
|
|
270
|
+
exits `0` when the condition holds, `1` on timeout or a terminal-failed job;
|
|
271
|
+
the `--json` shape is identical with or without `--wait`, and a failed wait
|
|
272
|
+
emits `{ ok: false, jobs[], error, kind: "wait_failed" }`.
|
|
273
|
+
With a hosted `<run-id>`: fetches that run's status, grade evidence, and
|
|
274
|
+
artifacts. This is the take-over entry point. `--json` emits
|
|
275
|
+
`{ ok, run, gradeEvidence, artifacts }`; `--artifact <artifactId>` prints one
|
|
276
|
+
artifact's payload instead. The wait-family flags and `--repo` are local-only
|
|
277
|
+
and cannot be combined with a run id.
|
|
278
|
+
- `archal autoloop reprocess [trace-id] | --all-failed` - re-queue terminal
|
|
279
|
+
local trace jobs after fixing the blocker. Hidden from help (repair escape
|
|
280
|
+
hatch), still runnable.
|
|
281
|
+
- `archal autoloop detach <trace-dir>` - stop a local file-backed loop. Does
|
|
282
|
+
not disable a hosted source.
|
|
283
|
+
|
|
284
|
+
Related commands used during take-over and debugging:
|
|
285
|
+
|
|
286
|
+
- `archal reproduce failures <grades> --json` - turn failed grades into a
|
|
287
|
+
seedable reproduction package. `archal reproduce verify <package-dir> --json`
|
|
288
|
+
re-checks seed and run evidence for an existing package.
|
|
289
|
+
- `archal grade trace --request <file> --json` - grade one trace.
|
|
290
|
+
- `archal autoloop status --json` - inspect registered sources and job state.
|
|
291
|
+
- `archal traces list|detail --json` - list and inspect uploaded traces.
|
|
292
|
+
|
|
293
|
+
Exit codes across this family: `0` success, `1` failure, `2` usage error or
|
|
294
|
+
not-ready. Failures under `--json` emit `{ ok: false, error, kind, ... }`.
|
|
295
|
+
|
|
296
|
+
## Take-over workflow
|
|
297
|
+
|
|
298
|
+
The killer use case: autoloop graded (and, under `reproduce`, replayed) a real
|
|
299
|
+
production failure, and now a coding agent takes over to write and verify the
|
|
300
|
+
fix. Runbook:
|
|
301
|
+
|
|
302
|
+
1. **Find the run.** `archal autoloop status --json` for local jobs, or use the
|
|
303
|
+
hosted run id you were handed. Note the trace id and phase.
|
|
304
|
+
2. **Pull the evidence into context.** `archal autoloop status <run-id> --json`
|
|
305
|
+
returns `run` (grade status, failure class, reproduction status, PR/branch
|
|
306
|
+
if any, blocking reason), `gradeEvidence` (score, threshold, summary,
|
|
307
|
+
per-criterion results), and `artifacts` (ids, types, sizes).
|
|
308
|
+
3. **Fetch the artifact you need.** For a specific payload (grade summary,
|
|
309
|
+
generated scenario, seed, run manifest), pass its id:
|
|
310
|
+
`archal autoloop status <run-id> --artifact <artifactId> --json`. For a
|
|
311
|
+
local loop, the same evidence is on disk under `.archal/autoloop/` (see the
|
|
312
|
+
artifact guide).
|
|
313
|
+
4. **Reproduce locally.** Turn the graded failure into a reproduction package
|
|
314
|
+
and replay it against clones: `archal reproduce failures <grades> --json`
|
|
315
|
+
(point `<grades>` at the local `grades/<trace>/grade.json` or a grade
|
|
316
|
+
artifact directory). This confirms the failure is real before you touch code.
|
|
317
|
+
5. **Write the fix** in the repo.
|
|
318
|
+
6. **Verify against the same reproduction.** `archal reproduce verify <package-dir> --json`
|
|
319
|
+
(or re-run step 4). The fix is done when the same reproduction that failed
|
|
320
|
+
now passes.
|
|
321
|
+
7. **Watch it land.** With Autofix ON, autoloop opens the PR; gate on it with
|
|
322
|
+
`archal autoloop status --wait --until pr` or watch the
|
|
323
|
+
PR directly. With Autofix OFF, open the PR yourself once the reproduction
|
|
324
|
+
passes.
|
|
325
|
+
|
|
326
|
+
## Diagnose failures
|
|
327
|
+
|
|
328
|
+
Classify precisely; do not manufacture a seed or claim reproduction succeeded
|
|
329
|
+
when evidence is thin.
|
|
330
|
+
|
|
331
|
+
- **Trace import** - source auth, mapping, cursor, filters, or a bad trace shape.
|
|
332
|
+
- **Trace ingestion** - rejected upload, missing workspace auth, bad idempotency
|
|
333
|
+
key, or OTLP receiver auth failure.
|
|
334
|
+
- **Grade** - judge could not determine the expected outcome; missing evaluator
|
|
335
|
+
contract; trace lacks task context.
|
|
336
|
+
- **Missing evidence** - trace lacks enough state to seed. Add spans, state
|
|
337
|
+
snapshots, or repo-owned seed templates.
|
|
338
|
+
- **Reproduction** - scenario or seed could not replay the failure. Inspect the
|
|
339
|
+
generated `scenario.md`, `seed.json`, and run manifest.
|
|
340
|
+
- **Harness** - agent command crashes, hangs, needs UI auth, or never reaches
|
|
341
|
+
clone-routed services.
|
|
342
|
+
- **Fix generation** - patch does not apply, tests fail, no changes produced,
|
|
343
|
+
or PR metadata is incomplete.
|
|
344
|
+
- **GitHub** - App missing, branch protection, permission denied, or PR checks
|
|
345
|
+
unavailable. Re-run `archal autoloop --check --json` to confirm.
|
|
346
|
+
|
|
347
|
+
## Artifact reading guide (local loops)
|
|
348
|
+
|
|
349
|
+
Local file-backed loops write repo-local artifacts; hosted loops expose the
|
|
350
|
+
same phase information through `archal autoloop status <run-id>`.
|
|
329
351
|
|
|
330
352
|
| Artifact | What to inspect |
|
|
331
353
|
|----------|-----------------|
|
|
332
354
|
| `grades/<trace>/routing.json` | trace import route and selected phase |
|
|
333
|
-
| `grades/<trace>/grade.json` | verdict, summary,
|
|
355
|
+
| `grades/<trace>/grade.json` | verdict, summary, reproduction decision |
|
|
334
356
|
| `seeds/<trace>/scenario.md` | generated reproduction scenario |
|
|
335
|
-
| `seeds/<trace>/seed.json` |
|
|
336
|
-
| `runs/<trace>/manifest.json` | reproduction status, command, attempts
|
|
357
|
+
| `seeds/<trace>/seed.json` | materialized seed metadata |
|
|
358
|
+
| `runs/<trace>/manifest.json` | reproduction status, command, attempts |
|
|
337
359
|
| `runs/<trace>/stdout.json` | machine-readable run output |
|
|
338
|
-
| `runs/<trace>/stderr.log` | reproduction stderr |
|
|
339
360
|
| `fixes/<trace>/status.json` | blocked fix status |
|
|
340
361
|
| `fixes/<trace>/pr-details.md` | PR reviewer summary |
|
|
341
362
|
| `fixes/<trace>/repo.patch` | patch captured when PR creation cannot complete |
|
|
342
363
|
|
|
343
364
|
## Security rules
|
|
344
365
|
|
|
345
|
-
- Use read-only trace database credentials.
|
|
346
|
-
- Never commit database URLs, API keys, model keys, or GitHub tokens.
|
|
347
|
-
|
|
348
|
-
production
|
|
366
|
+
- Use read-only trace database credentials (Breakpoint 3).
|
|
367
|
+
- Never commit or echo database URLs, API keys, model keys, or GitHub tokens.
|
|
368
|
+
Prefer `--database-url-env` locally and `--database-url-secret-ref` in hosted
|
|
369
|
+
production.
|
|
349
370
|
- Do not pass production write credentials to a clone-routed reproduction.
|
|
350
371
|
- Do not add model-visible copy that reveals Archal or clone routing to the
|
|
351
372
|
tested agent.
|
|
@@ -354,23 +375,17 @@ same phase information in the dashboard.
|
|
|
354
375
|
|
|
355
376
|
## What to report back
|
|
356
377
|
|
|
357
|
-
After setup or debugging, give the user:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
- CLI status command to run next
|
|
364
|
-
- artifacts produced, if local
|
|
365
|
-
- whether import, grade, seed, reproduce, and fix phases are ready
|
|
366
|
-
- exact blocker if any
|
|
367
|
-
- next command or next owner
|
|
378
|
+
After setup or debugging, give the user: the command run; the execution policy
|
|
379
|
+
and how it maps to the Autofix answer from Breakpoint 1; source provider and id;
|
|
380
|
+
repo full name; which phases (import, grade, seed, reproduce, fix) are ready;
|
|
381
|
+
the exact blocker if any; local artifact paths if applicable; and the next CLI
|
|
382
|
+
command or owner. Prefer CLI and artifact evidence over telling the user to open
|
|
383
|
+
a dashboard page.
|
|
368
384
|
|
|
369
385
|
## Docs
|
|
370
386
|
|
|
371
387
|
- Autoloop production traces: https://docs.archal.ai/guides/autoloop-production-traces
|
|
372
|
-
-
|
|
373
|
-
- CLI reference: https://docs.archal.ai/cli/autoloop
|
|
388
|
+
- Autoloop CLI: https://docs.archal.ai/cli/autoloop
|
|
374
389
|
- Running with an agent: https://docs.archal.ai/guides/run-with-agent
|
|
375
390
|
- Writing scenarios: https://docs.archal.ai/guides/writing-scenarios
|
|
376
391
|
- Seeds: https://docs.archal.ai/guides/seeds
|