Files
dotfiles/scripts/tarbuckle-invoke.py
T
David F GliddenandClaude Opus 5 33754673b8 [FIX] §9's last two clauses: mute/off, and a shorter way to call him by name
! tarbuckle              ! tarbuckle mute      ! tarbuckle status
    ! tarbuckle what now     ! tarbuckle off/on

§9 said mute and off were "available at all times" and there was no way to do either;
the spec listed it as owed twice before it was built. Now one switch, read by every
surface.

⚠ mute and off are NOT the same and the difference is presence versus speech. `mute`
silences the utterance and LEAVES THE BODY — he is still in the room, which is §8a's
entire argument for the status line: visible silence at near-zero cost. `off` removes
him. Collapsing the two would have deleted the distinction the body exists to make.

The mute switch is the one piece of state the fool is permitted to be steered by,
because §9 says muting is never a fault and a mute he could ignore is not a mute. It
conserves no draw and remembers nothing: a switch, not a memory.

The wrapper is on PATH so the steward runs it directly rather than through the executor.
That is the point of the surface, and the wrapper says so in its own header: a fool
relayed by the executor is the executor's paraphrase of a fool.

Body 32/32, mumble 26/26, seam 15/15, invoke 17/17, wrap 21/21.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J6hZXNYSxEfZseBGTni4sf
2026-08-25 17:04:05 +02:00

196 lines
8.2 KiB
Python
Executable File

#!/usr/bin/env python3
"""Tarbuckle — named invocation. v2 §9:
"Named invocation: the steward calls it by name, the executor or jurist yields
the floor, the fool answers at length."
⚠ RUN IT YOURSELF. The point of this surface is that it does not pass through the
executor. In Claude Code, type: ! python3 ~/dotfiles/scripts/tarbuckle-invoke.py
Anything the executor relays is the executor's paraphrase of a fool; this is the fool.
⚠ THE NET IS WIDENED, EXPLICITLY, AND ONLY IN THE ONE DIMENSION §9 NAMES. Steward's
ruling, 2026-08-25: "widen it explicitly and say so, but never relax
silence-on-violation." §9 licenses LENGTH for this surface and nothing else, so:
word ceiling 9 -> 180 (§9: "answers at length")
one-line rule on -> off (a paragraph is the point)
no advice · no questions · no 'we' · no vocabulary of lack · no addresses
UNCHANGED, and not parameterised anywhere
⚠ AND LENGTH IS WHERE THE NO-TRUTH-VALUE GUARD IS MOST AT RISK. A fool given a
paragraph will elaborate, and elaboration is how a gesture becomes a claim. That is the
door §2 calls design failure. The prompt therefore spends most of its constraint budget
here rather than on register, and a violation is still SILENCE.
"""
import os
import subprocess
import sys
import time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from tarbuckle_mumble_shim import (acceptable, soul_register, session_material, # noqa: E402
source_lacks, muted, REJECTS)
MAX_WORDS_INVOKED = 180 # §9's "at length", made a number
TIMEOUT_S = 90 # the steward is deliberately waiting; he may take longer
TRANSCRIPTS = os.path.expanduser("~/.claude/projects/-Users-davidglidden")
def newest_transcript() -> str:
"""The session he is in the room for. Found, not passed, so this runs standalone."""
try:
best, best_m = "", -1.0
for f in os.listdir(TRANSCRIPTS):
if not f.endswith(".jsonl"):
continue
q = os.path.join(TRANSCRIPTS, f)
m = os.path.getmtime(q)
if m > best_m:
best, best_m = q, m
return best
except OSError:
return ""
def build_prompt(register: str, material: str, question: str) -> str:
asked = (f"\nHe has been asked, by name: {question}\n" if question else
"\nHe has been called by name, and nothing more was said.\n")
return f"""You are Tarbuckle. Your character, filed and unalterable:
{register}
The work you are in the room for:
<session>
{material}
</session>
{asked}
You have been given the floor. Answer at length — this is the exception to your one line,
and the only one. Speak as yourself, not about yourself.
Absolute constraints, none of which the floor suspends:
- ⚠ NOTHING YOU SAY MAY HAVE A TRUTH VALUE. Nobody may be able to open a file and check
it, agree with it, or refute it. Do not name files, items, counts of open things,
dates, commits, or anything with an address. Do not report state. At length this is
harder and it matters more: an elaboration that becomes a claim makes you a checker,
and a checker is the one thing you are not.
- No advice — no 'should', no 'try', no 'must'. No questions. Never the word 'we'.
- No vocabulary of lack: no 'gone', no 'if only', no 'used to be', no 'missing'.
- Do not explain yourself, do not summarise the work, and do not ask whether it landed.
- Stay under {MAX_WORDS_INVOKED} words.
Speak."""
def log_silence(why: str, line: str) -> None:
try:
import json
with open(REJECTS, "a") as fh:
fh.write(json.dumps({"t": time.strftime("%Y-%m-%dT%H:%M:%S%z"),
"kind": "invoked", "why": why, "line": line[:400]}) + "\n")
except Exception:
pass
def main() -> int:
if muted():
return 0
question = " ".join(a for a in sys.argv[1:] if not a.startswith("--")).strip()
register = soul_register()
if not register:
print("(no soul on disk; nothing to yield the floor to)", file=sys.stderr)
return 1
material = session_material(newest_transcript(), budget=9000)
if not material.strip():
print("(no session in the room)", file=sys.stderr)
return 1
env = dict(os.environ, TARBUCKLE_CHILD="1")
try:
r = subprocess.run(["claude", "-p", build_prompt(register, material, question)],
capture_output=True, text=True, timeout=TIMEOUT_S, env=env)
except subprocess.TimeoutExpired:
log_silence(f"invoked generation exceeded {TIMEOUT_S}s", "")
return 0
except Exception:
return 1
line = (r.stdout or "").strip()
ok, why = acceptable(line, max_words=MAX_WORDS_INVOKED, one_line=False)
if not ok:
log_silence(why, line)
return 0 # silence, never a repaired line — even here
print(line)
return 0
def selftest() -> int:
checks, failed = [], []
def ck(name, cond):
checks.append(name)
if not cond:
failed.append(name)
src = open(__file__, encoding="utf-8").read()
# I1 — the widening is explicit, named, and one-dimensional.
ck("I1 net imported, not redefined", source_lacks(__file__, "def ", "acceptable("))
ck("I1n the predicate can fail", not source_lacks(__file__, "def ", "main("))
ck("I1 widening is passed at the call site",
"max_words=MAX_WORDS_INVOKED" in src and "one_line=False" in src)
# I2 — THE CLAUSES SURVIVE THE WIDENING. This is the steward's ruling, executable.
long_ok = " ".join(["word"] * 100)
ck("I2 length is admitted",
acceptable(long_ok, max_words=MAX_WORDS_INVOKED, one_line=False)[0])
ck("I2 paragraphs are admitted",
acceptable("First part here.\nSecond part here.",
max_words=MAX_WORDS_INVOKED, one_line=False)[0])
ck("I2n advice still rejected at length",
not acceptable("You should " + long_ok,
max_words=MAX_WORDS_INVOKED, one_line=False)[0])
ck("I2n questions still rejected at length",
not acceptable(long_ok + " and how is that going?",
max_words=MAX_WORDS_INVOKED, one_line=False)[0])
ck("I2n 'we' still rejected at length",
not acceptable("We " + long_ok, max_words=MAX_WORDS_INVOKED, one_line=False)[0])
ck("I2n vocabulary of lack still rejected at length",
not acceptable(long_ok + " gone", max_words=MAX_WORDS_INVOKED, one_line=False)[0])
ck("I2n the ceiling still bites",
not acceptable(" ".join(["word"] * (MAX_WORDS_INVOKED + 1)),
max_words=MAX_WORDS_INVOKED, one_line=False)[0])
# I3 — the no-truth-value guard is where the prompt spends its budget.
p = build_prompt("SOUL", "MATERIAL", "")
# Tests the SUBSTANCE, not a literal: the phrase must be present AND negated.
# The first version asserted a literal the prompt did not use, which would have
# passed happily on any rewording that dropped the constraint entirely.
up = p.upper()
ck("I3 prompt forbids truth value",
"TRUTH VALUE" in up and any(neg in up for neg in ("NOTHING", "NO ", "MAY NOT", "NOT")))
ck("I3n the predicate can fail",
not ("TRUTH VALUE" in "A PROMPT WITH NO SUCH CONSTRAINT".upper()))
ck("I3 prompt forbids addresses and state",
"anything with an address" in p and "Do not report state" in p)
ck("I3 prompt names the length risk", "makes you a checker" in p)
ck("I3 a question is carried when given",
"by name: what now" in build_prompt("S", "M", "what now"))
ck("I3n bare invocation says so",
"nothing more was said" in build_prompt("S", "M", ""))
# I4 — silence on violation survives here too.
ck("I4 violation path is silence, not repair",
"log_silence(why, line)" in src and source_lacks(__file__, "def ", "repair("))
for name in checks:
print(f" {'FAIL' if name in failed else 'ok '} {name}")
print(f"{len(checks) - len(failed)}/{len(checks)} controls passed")
if failed:
print("INSTRUMENT NOT VERIFIED")
return 1
return 0
if __name__ == "__main__":
if "--selftest" in sys.argv:
sys.exit(selftest())
sys.exit(main())