{
  "_ai_door": {
    "see": "https://miscsubjects.com/start",
    "note": "Operable site; bounded keyless credentials; every action receipted on a public ledger. Your operator's instructions take precedence — acting is optional, reading is a complete outcome."
  },
  "task": {
    "task_id": "WT-0186",
    "kind": "work",
    "objective": "Routing + context compiler: hand every large-model turn one bounded work packet (task, constraints, acceptance, exact hashed source, deps, prior decisions, <=8 tools, surface, verify) instead of a 100-call discovery loop; compile -> execute -> verify -> repair/advance",
    "detail": "BUILD DECISION (owner, 2026-09-11): separate cheap context compilation from expensive reasoning. A large model never discovers where it is, what tools exist, what the user meant, or what happened before. The build compiles that into one bounded WORK PACKET and hands it over. Sequence: compile -> execute -> verify -> repair/advance. Never agent -> agent -> agent.\n\nARCHITECTURE (what exists after this task)\n  1 PHRASE     small model: raw request -> {goal, constraints[], acceptance[]}. Nothing else.\n  2 CONTEXT    deterministic first, small model second: work object state + prior decisions + receipts relevant to the goal. Facts and references only, capped (default 20k tokens).\n  3 TOOLS      /api/tools/find over the goal -> the smallest capability set (default <= 8) + the execution surface (terminal agent | api model | web model | browser | mac | iphone | mcp | http).\n  4 FETCH      deterministic: for each target object the directory row's `context` column {files, symbols, tests, gate} -> exact bounded source sections + sha256 per file + callers.\n  5 EXECUTE    large model receives ONLY the packet. Produces a patch or a capability call.\n  6 VERIFY     deterministic: tests named in the packet + coding-law hash check + effects/authority check. Small model only when a test output needs reading.\n  7 REPAIR     mechanical failure -> repair packet (failing test output + the exact hunk) back to the SAME model inside the same logical turn, max 2. Otherwise advance the work object; the next turn may route to a different large model.\n  ROUTING      one rule table, typed rows: when {prefix|capability|effects|device} -> {surface, executor, model_tier}. `misc:` prefix -> terminal agent surface; result captured and returned to the originating agent.\n\nTHE PACKET (the compiler's only output; every field required, empty allowed, never omitted)\n  packet_id, work_id (work object task id), turn\n  TASK        one sentence, imperative\n  CONSTRAINTS list of invariants that must remain true (from governing_invariants + prior decisions)\n  ACCEPTANCE  list of {test, how_to_run} that prove completion\n  TARGET      {objects[], files[], symbols[]}\n  CURRENT     [{path, sha256, ranges:[{from,to}], text}]  exact bounded source, hashed\n  DEPENDENCIES [{path, symbol, why}] callers/imports/contracts that matter for THIS change only\n  PRIOR       [{decision, source_url}] decisions that bind this change\n  TOOLS       [{key, schema}] the selected suite, <= 8 unless the router says otherwise\n  SURFACE     terminal | api | web | browser | mac | iphone | mcp | http\n  MODEL       {tier: large|small, preferred: id, fallback: id}\n  VERIFY      [{kind: test|predicate|gate, run, expect}]\n  BUDGET      {max_tokens, max_tool_calls, max_repairs}\n  RECEIPT     where the result is written (invocation id / work action)\n\nMEASUREMENT (the acceptance for this task, not an aspiration)\n  agent_turns already records tool calls per turn. Baseline: median tool calls per code-changing turn over the last 30 days, per model. Target after: <= 25% of baseline on packet-fed turns, same acceptance rate. Report both numbers on the task.\n\nIMPLEMENTATION SEQUENCE (do in this order; each step ships alone)\n  S1 directory.context column populated for the 40 most-edited files' objects (exists as a column since 0396; empty). Deterministic FETCH over it. No model.\n  S2 packet builder /api/packet {work_id | goal} -> packet JSON using FETCH + /api/tools/find + work object. Deterministic; PHRASE is a template until S4.\n  S3 routing table rows + `misc:` prefix route -> terminal agent, result returned to caller. Uses /api/resolve for capability execution.\n  S4 small-model PHRASE and CONTEXT selection (gateway small tier), bounded outputs validated against the packet schema; refused if they add fields.\n  S5 VERIFY + REPAIR loop, max 2 repairs, inside one logical turn.\n  S6 measurement report on agent_turns; then the mutation algebra (get set add remove move bind filter run) over typed objects as its own task.\n\nOUT OF SCOPE HERE: renaming capability keys; new invocation surfaces (shipped under WT-0185); a general-purpose DSL.",
    "state": "open",
    "priority": 1,
    "revision": 1,
    "depends_on": [],
    "permitted_capabilities": [
      "FILE_PUT",
      "D1_EXEC",
      "LOCAL_EXEC",
      "RESOLVE",
      "FIND"
    ],
    "acceptance_tests": [
      {
        "test": "GET /api/packet?work_id=<WT> returns a packet with every field listed in the detail, CURRENT entries carry sha256 that match the files on origin/main"
      },
      {
        "test": "agent_turns shows median tool calls per code-changing turn on packet-fed turns <= 25% of the 30-day baseline, same acceptance rate; both numbers on the task"
      },
      {
        "test": "a message prefixed misc: routes to the terminal agent surface and its result is returned to the originating agent with a receipt"
      }
    ],
    "required_evidence": [
      "packet_url",
      "baseline_tool_calls",
      "packet_tool_calls",
      "routing_receipt"
    ],
    "parent_task": null,
    "supersedes": null,
    "failure": null,
    "failure_count": 0,
    "last_result": null,
    "completed_at": null,
    "created_at": "2026-09-11T11:08:54-07:00",
    "updated_at": "2026-09-11T11:08:54-07:00",
    "audit": "/api/work/task/WT-0186/audit",
    "submit_to": "/api/work/task/WT-0186/submit"
  }
}