Skip to content

Draw the graph, route on history, and test policy against history - #56

Merged
blocksifrdev merged 1 commit into
mainfrom
feat/visual-graph-history-whatif
Sep 15, 2026
Merged

blocksifrdev merged 1 commit into
mainfrom
feat/visual-graph-history-whatif

Conversation

@blocksifrdev

Copy link
Copy Markdown
Collaborator

The three places the doctrine was still ahead of the code.

1. The graph was ASCII

It is supposed to be the visual model of execution authority — and it is what a developer sees in the first sixty seconds.

pctr graph --svg
pctr graph --svg route.svg payments.transfer   # with the selected route drawn

the execution authority graph

Columns run principal → agents → tools → actions. Agents carry framework, live trust and a clock mark when evidence is stale; actions are coloured by severity and marked ! when protected; naming an action draws its route in green and dims the rest. Standalone SVG — no fonts, no scripts, no network.

Every graph carries an aria-label describing the route in words. I rendered it to PNG and actually looked at it: the first two passes had tofu boxes where the brand fonts have no arrow or clock glyph, so those are drawn as paths now, and the legend no longer overlaps itself.

2. Routing ignored what happened

resolveRoute now accepts accumulated history and prefers routes that work.

The constraint that matters: history only reorders routes that already passed every admissibility check. A flawless record buys no authority. There's a test that hands an unauthorized agent twenty clean receipts and asserts it still cannot route — optimization happens after admissibility, never instead of it.

3. No way to test a policy against reality

pctr whatif --policy '{"approvalThresholds":{"amount":25000}}'
Executions replayed   10
Decided the same      5
Would tighten         3
Would loosen          1

1 execution(s) that were refused would now proceed

Nothing executes — each recorded receipt is re-decided under the proposed policy. Exits non-zero when a change would loosen anything, so it gates policy edits in CI.

Writing its test surfaced something worth stating outright, and it's now its own test: raising an approval threshold cannot unlock a CRITICAL consequence, because severity comes from what the action can cause, not from the rule that reads it.

Verification

167 tests (11 new), Python 19, AGT parity green at 52 checks.

🤖 Generated with Claude Code

The three places the doctrine was still ahead of the code.

1. The graph was ASCII. It is supposed to be the visual model of
   execution authority, and it is what a developer sees in the first
   sixty seconds. pctr graph --svg draws principal -> agents -> tools ->
   actions: agents carry framework, live trust and a clock mark when
   evidence is stale, actions are coloured by severity and marked when
   they are a protected consequence, and naming an action draws its
   selected route in green with everything else dimmed. Standalone SVG —
   no fonts, no scripts, no network — so it drops into a README.

   Every graph carries an aria-label describing the route in words. I
   rendered it to PNG and looked at it: the first two passes had tofu
   boxes where the brand fonts have no arrow or clock glyph, so those are
   drawn as paths now, and the legend no longer overlaps itself.

2. Routing ignored what happened. resolveRoute now takes accumulated
   history and prefers routes that work. The constraint that matters:
   history only reorders routes that already passed every admissibility
   check. A flawless record buys no authority — there is a test that
   gives an unauthorized agent twenty clean receipts and asserts it still
   cannot route.

3. No way to test a policy against reality. pctr whatif re-decides every
   recorded receipt under a proposed policy, executing nothing, and exits
   non-zero when a change would loosen anything, so it gates policy edits
   in CI.

   Writing its test surfaced something worth stating: raising an approval
   threshold cannot unlock a CRITICAL consequence, because severity comes
   from what the action can cause, not from the rule that reads it. That
   is now its own test.

167 tests (11 new).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@blocksifrdev
blocksifrdev merged commit b423e20 into main Sep 15, 2026
4 checks passed
@blocksifrdev
blocksifrdev deleted the feat/visual-graph-history-whatif branch September 15, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant