mirror of
https://github.com/bdbrown4/peltier.io.git
synced 2026-11-07 10:58:28 +00:00
Commit the spec and scaffold the system it describes:
- SPEC.md: the full v0.1 engineering spec
- crates/: trust-layer Rust workspace, unit-tested
- bench-runner: interleaved ABAB scheduling with discarded warm-ups,
deterministic bootstrap CIs over the ratio of medians,
CI-lower-bound accept rule, env fingerprinting, and a CLI with
compare + A/A self-test modes (A/A verified passing end-to-end)
- diff-test: gate outcome model, sha256 corpus pin verifier that
refuses on mismatch, per-target equivalence policy parser
(byte-identical default, explicit fp-tolerance opt-in)
- ledger: append-only SQLite attempt schema with UPDATE/DELETE
refused by triggers, anti-double-attempt query
- report: cores-saved and dollars/yr ROI math over speedup CIs,
pricing.toml inputs
- playbook/: classes 1-7 with preconditions, procedure, verification
notes, and known failure modes per class
- agent/: Python package skeleton — six-tool contract and prompting
spine, harness IPC deferred to Phase 1
- config/: accept.toml (2% threshold, 30 runs/side), pricing.toml
- targets/, corpora/, results/calibration/: layout and policy docs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcKPWQ3MQD4NdEHwar96u2
60 lines
2.4 KiB
Python
60 lines
2.4 KiB
Python
"""Tool surface exposed to the model (SPEC §3.5).
|
|
|
|
Exactly six tools, all mediated by the trust-layer harness over IPC —
|
|
the agent process has no direct filesystem or shell capability beyond
|
|
what these return. Deliberately NOT exposed: shell on the host, writes
|
|
outside targets/<name>/, any access to crates/, config/, corpora/.
|
|
|
|
Phase 2 wiring: each function below becomes a Claude Agent SDK tool
|
|
definition whose implementation calls the harness. The signatures and
|
|
docstrings are the contract; the bodies are placeholders until the
|
|
harness IPC exists (Phase 1 exit criteria).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
class HarnessUnavailable(RuntimeError):
|
|
"""Raised until the Phase 1 trust-layer harness IPC is wired up."""
|
|
|
|
|
|
def read_profile(target: str) -> dict[str, Any]:
|
|
"""Latest profile for a target: ranked hotspots (symbol, exclusive %,
|
|
source mapping) plus perf stat counters. Read-only."""
|
|
raise HarnessUnavailable("profiler adapter not wired (Phase 1)")
|
|
|
|
|
|
def read_ledger(target: str) -> list[dict[str, Any]]:
|
|
"""All prior attempts against this target — the anti-double-attempt
|
|
memory. The agent must not re-grind a (hotspot, playbook_class,
|
|
hypothesis) combination that already has a verdict."""
|
|
raise HarnessUnavailable("ledger IPC not wired (Phase 1)")
|
|
|
|
|
|
def read_playbook(class_number: int) -> str:
|
|
"""Playbook class markdown (1-7): preconditions, procedure,
|
|
verification notes, known failure modes."""
|
|
raise HarnessUnavailable("playbook IPC not wired (Phase 1)")
|
|
|
|
|
|
def read_target_source(target: str, path: str) -> str:
|
|
"""Read-only view of the target's source tree at the pinned commit."""
|
|
raise HarnessUnavailable("source IPC not wired (Phase 1)")
|
|
|
|
|
|
def propose_patch(target: str, diff: str, hypothesis: str) -> str:
|
|
"""Submit a unified diff plus the hypothesis it tests. The harness
|
|
applies it via `git apply` after a path-allowlist check (SPEC §10);
|
|
a diff touching anything outside targets/<target>/ is auto-rejected
|
|
before any gate runs. Returns a patch id."""
|
|
raise HarnessUnavailable("patch IPC not wired (Phase 1)")
|
|
|
|
|
|
def run_verdict(patch_id: str) -> dict[str, Any]:
|
|
"""Run the full gate + bench sequence on a proposed patch and return
|
|
the ledger row (gates, bench CIs, verdict). This is the only way the
|
|
agent ever learns whether a change 'worked' — there is no other
|
|
number to optimize."""
|
|
raise HarnessUnavailable("verdict IPC not wired (Phase 1)")
|