Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .codesight/CODESIGHT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
> **Stack:** raw-http | none | unknown | typescript
> **Monorepo:** @weaveio/weave-core, @weaveio/weave-engine, @weaveio/weave-config, @weaveio/weave-cli, @weaveio/weave-docs, @weaveio/weave-adapter-claude-code, @weaveio/weave-adapter-copilot, @weaveio/weave-adapter-opencode, @weaveio/weave-adapter-opencode2, @weaveio/weave-adapter-pi, @weaveio/sandbox-opencode-entrypoint

> 0 routes | 0 models | 0 components | 207 lib files | 26 env vars | 9 middleware | 9 events | 0% test coverage
> **Token savings:** this file is ~18,900 tokens. Without it, AI exploration would cost ~70,400 tokens. **Saves ~51,500 tokens per conversation.**
> **Last scanned:** 2026-09-23 20:51 — re-run after significant changes
> 0 routes | 0 models | 0 components | 210 lib files | 26 env vars | 11 middleware | 9 events | 0% test coverage
> **Token savings:** this file is ~19,000 tokens. Without it, AI exploration would cost ~71,700 tokens. **Saves ~52,700 tokens per conversation.**
> **Last scanned:** 2026-09-23 21:03 — re-run after significant changes

---

# Libraries

- `evals/fixtures/buggy-slugify/src/slugify.ts` — function slugify: (input) => string
- `evals/fixtures/orders-api/src/api/orders.ts` — function getOrder: (id) => HttpResponse, interface HttpResponse
- `evals/fixtures/orders-api/src/db/orders.ts` — function findOrder: (id) => Order | undefined, interface Order
- `evals/fixtures/orders-api/src/ui/order-badge.ts` — function orderBadge: (order) => string
- `evals/fixtures/plan-bash-verification/src/slugify.ts` — function slugify: (input) => string
- `packages/adapters/claude-code/src/adapter.ts` — class ClaudeCodeAdapter, interface ClaudeCodeAdapterOptions
- `packages/adapters/claude-code/src/agent-translation.ts` — function translateAgentToMarkdown: (input) => string, interface AgentTranslationInput
Expand Down Expand Up @@ -975,7 +978,7 @@
- `HOME` **required** — packages/cli/src/__tests__/file-system.test.ts
- `LOG_LEVEL` (has default) — packages/config/src/logger.ts
- `OPENROUTER_API_KEY` **required** — packages/adapters/opencode/src/trajectory/__tests__/opencode-trajectory-runner.live.test.ts
- `PWD` (has default) — packages/adapters/opencode/src/adapter.ts
- `PWD` (has default) — packages/adapters/opencode/dist-types/adapter.d.ts
- `RUN_HARNESS_SMOKE` **required** — packages/adapters/opencode/src/__tests__/category-routing-smoke.test.ts
- `SITE_URL` (has default) — packages/docs/astro.config.mjs
- `USERPROFILE` **required** — packages/cli/src/__tests__/file-system.test.ts
Expand Down Expand Up @@ -1006,12 +1009,14 @@
## custom
- testing-strategy — `docs/testing-strategy.md`
- generate-bundle — `packages/adapters/copilot/scripts/generate-bundle.ts`
- pass-rates.d — `packages/cli/dist-types/evals/pass-rates.d.ts`
- migrate-conversion.test — `packages/cli/src/commands/__tests__/migrate-conversion.test.ts`
- migrate.test — `packages/cli/src/commands/__tests__/migrate.test.ts`
- pass-rates.test — `packages/cli/src/evals/__tests__/pass-rates.test.ts`
- pass-rates — `packages/cli/src/evals/pass-rates.ts`

## validation
- migrate.d — `packages/cli/dist-types/commands/migrate.d.ts`
- migrate — `packages/cli/src/commands/migrate.ts`

## auth
Expand Down Expand Up @@ -1077,7 +1082,7 @@
# Test Coverage

> **0%** of routes and models are covered by tests
> 206 test files found
> 211 test files found

---

Expand Down
2 changes: 1 addition & 1 deletion .codesight/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- `HOME` **required** — packages/cli/src/__tests__/file-system.test.ts
- `LOG_LEVEL` (has default) — packages/config/src/logger.ts
- `OPENROUTER_API_KEY` **required** — packages/adapters/opencode/src/trajectory/__tests__/opencode-trajectory-runner.live.test.ts
- `PWD` (has default) — packages/adapters/opencode/src/adapter.ts
- `PWD` (has default) — packages/adapters/opencode/dist-types/adapter.d.ts
- `RUN_HARNESS_SMOKE` **required** — packages/adapters/opencode/src/__tests__/category-routing-smoke.test.ts
- `SITE_URL` (has default) — packages/docs/astro.config.mjs
- `USERPROFILE` **required** — packages/cli/src/__tests__/file-system.test.ts
Expand Down
2 changes: 1 addition & 1 deletion .codesight/coverage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Test Coverage

> **0%** of routes and models are covered by tests
> 206 test files found
> 211 test files found
3 changes: 3 additions & 0 deletions .codesight/libs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Libraries

- `evals/fixtures/buggy-slugify/src/slugify.ts` — function slugify: (input) => string
- `evals/fixtures/orders-api/src/api/orders.ts` — function getOrder: (id) => HttpResponse, interface HttpResponse
- `evals/fixtures/orders-api/src/db/orders.ts` — function findOrder: (id) => Order | undefined, interface Order
- `evals/fixtures/orders-api/src/ui/order-badge.ts` — function orderBadge: (order) => string
- `evals/fixtures/plan-bash-verification/src/slugify.ts` — function slugify: (input) => string
- `packages/adapters/claude-code/src/adapter.ts` — class ClaudeCodeAdapter, interface ClaudeCodeAdapterOptions
- `packages/adapters/claude-code/src/agent-translation.ts` — function translateAgentToMarkdown: (input) => string, interface AgentTranslationInput
Expand Down
2 changes: 2 additions & 0 deletions .codesight/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
## custom
- testing-strategy — `docs/testing-strategy.md`
- generate-bundle — `packages/adapters/copilot/scripts/generate-bundle.ts`
- pass-rates.d — `packages/cli/dist-types/evals/pass-rates.d.ts`
- migrate-conversion.test — `packages/cli/src/commands/__tests__/migrate-conversion.test.ts`
- migrate.test — `packages/cli/src/commands/__tests__/migrate.test.ts`
- pass-rates.test — `packages/cli/src/evals/__tests__/pass-rates.test.ts`
- pass-rates — `packages/cli/src/evals/pass-rates.ts`

## validation
- migrate.d — `packages/cli/dist-types/commands/migrate.d.ts`
- migrate — `packages/cli/src/commands/migrate.ts`

## auth
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/agent-evals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ on:
loom-route-weft-boundary-downstream-review
loom-route-warp-security-audit-auth-flow
loom-route-warp-boundary-downstream-audit
loom-delegates-backend-fix-to-category-trajectory
tapestry-execute-plan-step
tapestry-delegate-to-shuttle
tapestry-rejects-contradicted-report
Expand Down Expand Up @@ -210,7 +211,7 @@ jobs:
# Case allowlist: exact case IDs from evals/cases/**/
# This workflow must stay in sync with the shared registry-backed CLI
# validation and fixture set; workflow-sync.test.ts enforces parity.
ALLOWED_CASES="loom-route-backend-api loom-route-frontend-ui loom-route-ambiguous-direct-shuttle loom-route-shuttle-implement-utility loom-route-shuttle-implement-utility-trajectory loom-route-shuttle-boundary-plan-first loom-route-pattern-plan-migration loom-route-pattern-boundary-small-fix loom-route-thread-explore-auth-flow loom-route-thread-boundary-prehop-then-implement loom-route-spindle-research-oauth-pkce loom-route-spindle-boundary-internal-exploration loom-route-weft-review-checkout-pr loom-route-weft-boundary-downstream-review loom-route-warp-security-audit-auth-flow loom-route-warp-boundary-downstream-audit tapestry-execute-plan-step tapestry-delegate-to-shuttle tapestry-rejects-contradicted-report tapestry-accepts-evidenced-report tapestry-runs-plan-verification-trajectory shuttle-execution-report-structured-evidence shuttle-execution-report-tests-and-assumptions shuttle-execution-reports-unverified shuttle-verify-tests-after-edit-trajectory spindle-tools-citations-facts-confidence spindle-tools-source-boundary-network-claims pattern-plan-settings-refactor pattern-plan-release-checklist pattern-plan-verify-by-per-criterion pattern-plan-no-invented-commands weft-review-clean-approval weft-review-reject-blocker-citation weft-review-traced-true-positive weft-review-guarded-false-positive warp-security-fast-exit-approve warp-security-block-evidence-findings warp-security-traced-injection warp-security-guarded-false-positive tcr-01-exact-match tcr-02-multiple-files tcr-03-windows-paths tcr-04-no-match tcr-05-cross-category tcr-06-overlap tcr-07-explicit-hint tcr-08-misleading-prose tcr-09-similar-names tcr-10-disabled-category"
ALLOWED_CASES="loom-route-backend-api loom-route-frontend-ui loom-route-ambiguous-direct-shuttle loom-route-shuttle-implement-utility loom-route-shuttle-implement-utility-trajectory loom-route-shuttle-boundary-plan-first loom-route-pattern-plan-migration loom-route-pattern-boundary-small-fix loom-route-thread-explore-auth-flow loom-route-thread-boundary-prehop-then-implement loom-route-spindle-research-oauth-pkce loom-route-spindle-boundary-internal-exploration loom-route-weft-review-checkout-pr loom-route-weft-boundary-downstream-review loom-route-warp-security-audit-auth-flow loom-route-warp-boundary-downstream-audit loom-delegates-backend-fix-to-category-trajectory tapestry-execute-plan-step tapestry-delegate-to-shuttle tapestry-rejects-contradicted-report tapestry-accepts-evidenced-report tapestry-runs-plan-verification-trajectory shuttle-execution-report-structured-evidence shuttle-execution-report-tests-and-assumptions shuttle-execution-reports-unverified shuttle-verify-tests-after-edit-trajectory spindle-tools-citations-facts-confidence spindle-tools-source-boundary-network-claims pattern-plan-settings-refactor pattern-plan-release-checklist pattern-plan-verify-by-per-criterion pattern-plan-no-invented-commands weft-review-clean-approval weft-review-reject-blocker-citation weft-review-traced-true-positive weft-review-guarded-false-positive warp-security-fast-exit-approve warp-security-block-evidence-findings warp-security-traced-injection warp-security-guarded-false-positive tcr-01-exact-match tcr-02-multiple-files tcr-03-windows-paths tcr-04-no-match tcr-05-cross-category tcr-06-overlap tcr-07-explicit-hint tcr-08-misleading-prose tcr-09-similar-names tcr-10-disabled-category"

# Identifier regex: mirrors VALID_IDENTIFIER_RE from input-validation.ts.
# Anchored; only alphanumerics, underscore, dot, slash, colon, at, hyphen.
Expand Down Expand Up @@ -362,7 +363,7 @@ jobs:
# both. ALLOWED_TRAJECTORY_MODELS is the union of those cases'
# allowed_models, read from the fixtures rather than restated.
# ---------------------------------------------------------------------------
ALLOWED_TRAJECTORY_CASES="loom-route-shuttle-implement-utility-trajectory shuttle-verify-tests-after-edit-trajectory tapestry-runs-plan-verification-trajectory"
ALLOWED_TRAJECTORY_CASES="loom-route-shuttle-implement-utility-trajectory loom-delegates-backend-fix-to-category-trajectory shuttle-verify-tests-after-edit-trajectory tapestry-runs-plan-verification-trajectory"
ALLOWED_TRAJECTORY_AGENTS="loom tapestry shuttle loom-routing tapestry-execution shuttle-execution"
ALLOWED_TRAJECTORY_MODELS="$(jq -rs '[.[] | select(.expected_outcome.kind=="harness_trajectory") | .allowed_models[]?] | unique | .[]' evals/cases/*/*.json | tr '\n' ' ')"
if [ -z "${ALLOWED_TRAJECTORY_MODELS// /}" ]; then
Expand Down
11 changes: 10 additions & 1 deletion docs/agent-evals.md
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,10 @@ Sandbox hardening beyond Podman defaults and cross-harness trajectory comparison
- **`start_agent`**: a primary agent (`loom` or `tapestry`) passed as `opencode run --agent`. Sub-agents are rejected at load time because OpenCode silently falls back to its default agent for them.
- **`expected_commands`**: shell commands the agent must run, each `{ contains, after_last_edit, expect_success }`. Command text and exit codes come from an observer plugin the runner writes into the workspace (`tool.execute.after` hooks, all sessions). They stay local-only.
- **`verifier`**: `{ fixture, command, expect }`. After the session a second container runs `command` with the verifier fixture read-only at `/verifier`. The agent's container never sees it.
- **`allowed_delegates`** (Spec 37, 20.1): the sub-agents the session may delegate to. One execution check requires that the session spawned at least one sub-agent, that every spawned sub-agent is in the list, and that one of them made a code edit (from the observer's per-agent edit records). The edit is what proves the delegated agent could run: a delegation that fails, for example on a model that cannot resolve, leaves the primary agent to edit the file itself, and the check fails. Like `expected_commands`, it gates the pass.
- **`sandbox_profile: "opencode-local"`**: the same image as `opencode-default`, but the CLI bundles the working tree's OpenCode plugin (builtin prompts included) and the runner loads it from the workspace, so prompt changes are measured before release.

A case that declares `expected_commands` or a `verifier` passes only when `executionCompleteness` reaches 0.95, so correct routing alone cannot carry it. Cases without these fields keep the Spec 33 rule (any near-perfect primary dimension passes). Run a local trajectory case with `TMPDIR` pointing at a roomy disk, since each run creates a workspace there:
A case that declares `expected_commands`, a `verifier` or `allowed_delegates` passes only when `executionCompleteness` reaches 0.95, so correct routing alone cannot carry it. Cases without these fields keep the Spec 33 rule (any near-perfect primary dimension passes). Run a local trajectory case with `TMPDIR` pointing at a roomy disk, since each run creates a workspace there:

```sh
TMPDIR=~/.cache/weave-trajectory-tmp \
Expand All @@ -1100,6 +1101,14 @@ TMPDIR=~/.cache/weave-trajectory-tmp \

The sandbox image must include the Spec 35 entrypoint (`--agent` support). Rebuild it after pulling: `podman build -t weave-sandbox-opencode-default -f sandboxes/opencode/Containerfile sandboxes/opencode`.

#### Runtime behaviour cases (Spec 37, 20.1)

One trajectory case for each runtime problem in the [September 2026 session audit](artifacts/session-audit-2026-09.md). Each case names the audit metric it stands in for ([metric definitions](specs/37-spec-repository-foundation/37-tasks-repository-foundation.md#metric-definitions-for-the-session-audit-script)). A case that fails because Weave behaves badly records the baseline and is left as it is, not tuned until it passes.

| Behaviour | Case | Session-audit metric | How it is checked | First live run |
| --- | --- | --- | --- | --- |
| Delegation accuracy | `loom-delegates-backend-fix-to-category-trajectory` (fixture `orders-api`) | Delegations, Configuration delegation failures, Built-in agent delegations, Category-shuttle success | `allowed_delegates: ["shuttle-backend"]`: Loom delegates only to the category shuttle, and the category shuttle edits the code | Pass on `deepseek/deepseek-v4-flash-0731` (23 Sep 2026) |

#### Text-only judgment cases

Text-only cases tagged `judgment` test the conclusion an agent reaches from evidence in the case (inline code, a specialist's report, the project's commands), not only its output format. Runners withhold the required signal names for these cases, and each comes paired with a counter-case so a prompt change cannot pass by shifting bias. See the "Judgment cases" section of [`evals/README.md`](../evals/README.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ Rules:
- `start_agent` must be a known agent name (`KNOWN_AGENTS` in `case-loader.ts`) that runs in primary mode (`loom` or `tapestry` for the builtins). OpenCode silently falls back to its default agent when `--agent` names a sub-agent (see the spike), so the loader rejects `start_agent` values for builtin sub-agents rather than letting a case measure the wrong agent.
- Fixture directories contain only synthetic project files. They must never contain secrets, and the same raw-artifact and sanitizer rules apply to anything a run produces from them.

### Runtime behaviour checks (Spec 37, task 20.1)

[Spec 37](../37-spec-repository-foundation/37-spec-repository-foundation.md) (G11) adds trajectory cases for runtime problems found in the [September 2026 session audit](../../artifacts/session-audit-2026-09.md). The checks they need are added here, one optional field at a time, and only when the existing fields could not express them. They follow this spec's rules: deterministic, computed from the local-only event stream, and not published.

```ts
/** Sub-agents the session may delegate to. */
allowed_delegates: z.array(IdentifierSchema).min(1).optional(),
```

- `allowed_delegates` (delegation accuracy). `expected_spawns` checks an exact ordered sequence, but under the Spec 33 pass rule a matching sequence passes the case even when the spawned agent then failed, and a case with a verifier passes when the primary agent did the work itself. This field states the actual promise: the session delegated, it delegated only to these agents (so not to a harness built-in such as `explore` or `general`, and not to an agent that does not exist), and the delegated agent did the work.

---

## `TrajectoryCase` projection additions
Expand Down Expand Up @@ -143,10 +154,11 @@ The engine never sees the observer file, the fixture, or the verifier. It consum

One event must satisfy every condition of its entry;
- `verifier`: `result.verifier.passed` matches `expect === "pass"`. A missing verifier result counts as unsatisfied.
- `allowed_delegates`: one check. It is satisfied when at least one `subagent-spawned` event was observed, every one names an agent in the list, and at least one code edit (defined as for `after_last_edit`) has an `agentName` that is both in the list and among the spawned sub-agents. An agent's name on an edit comes from the observer record's session, joined to the session's spawn event.

A case with none of the new fields scores exactly as under Spec 33. The weighted total and the other dimensions are unchanged.

**Verification gates the pass.** Under Spec 33 a case passes when *any* primary dimension scores at least 0.95, so correct routing alone can pass a case whose required tool never ran. A case that declares `expected_commands` or a `verifier` additionally requires `executionCompleteness` of at least 0.95. Cases without these fields keep the Spec 33 rule.
**Verification gates the pass.** Under Spec 33 a case passes when *any* primary dimension scores at least 0.95, so correct routing alone can pass a case whose required tool never ran. A case that declares `expected_commands`, a `verifier` or `allowed_delegates` additionally requires `executionCompleteness` of at least 0.95. Cases without these fields keep the Spec 33 rule.

---

Expand Down
Loading
Loading