Plan: Minimal Integration MVP for WFGY semantic firewall
thanks for the green light. i’ll push a tiny MVP so we can validate the idea in your stack first, then decide how deep we go.
0) goal in one line
add a lightweight pre-gen semantic firewall that checks role drift and context fit before the agent/tool runs. pass if ΔS ≤ 0.45 and coverage ≥ 0.70. if not, auto-reset or compress.
1) insertion point for MVP
Path A: prompt-wrapper proxy (no infra change)
- intercept request right before model call
- compute ΔS with anchors
- if drift: rewrite or re-init, else pass through
we can add Path B (embedding gate) later if you want, but path A gets us a fast win.
2) deliverables
wfgy_guard.py a single file CLI
spec.yaml anchors + weights + thresholds
examples/ 3 tiny tasks for repro
report.json per call telemetry
3) CLI
# init a sample spec
python wfgy_guard.py init --out spec.yaml
# run guard once
python wfgy_guard.py guard \
--input input.txt \
--goal goal.txt \
--spec spec.yaml \
--out report.json
# pipe mode for easy proxy
cat prompt.txt | python wfgy_guard.py guard --goal goal.txt --spec spec.yaml
4) spec.yaml (minimal)
anchors:
entities: ["invoice", "due date", "customer id"]
relations: ["invoice->due date", "customer id->lookup"]
constraints: ["net-30", "usd only"]
weights:
w_e: 0.5
w_r: 0.3
w_c: 0.2
thresholds:
delta_s_max: 0.45
coverage_min: 0.70
actions:
on_drift: ["reset_role", "compress_context"]
on_low_cov: ["add_missing_anchors"]
5) telemetry (always printed)
triage=No.1|No.5 delta_s=0.38 coverage=0.74 lambda=convergent decision=pass
triage maps to failure patterns we observe during guard
decision is pass|rewrite|reset
6) acceptance targets
- ΔS ≤ 0.45 on 3 consecutive runs for the same task
- coverage ≥ 0.70 with anchors present
- no role drift across retry 1→3
7) quick dataset to reproduce
ex1_tool_pick.txt tests wrong tool loop
ex2_role_swap.txt tests role drift
ex3_cold_boot.txt tests first call garbage
8) scope and time
- day 1 ship CLI + spec + examples
- day 2 wire into your pipeline as a thin proxy function
- day 3 tune anchors with your real tasks, confirm targets
- day 4 optional: add
--ci mode to fail builds on drift
9) extension options after MVP
- Path B: embedding gate before retrieval, normalize vectors, add trace IDs
- Path C: multi-agent lock ordering and token passing to prevent deadlock
- Path D: recovery bridges for stalled steps
if this looks good, i’ll open a PR with the single-file CLI and the sample spec, then we tune it together on your tasks. happy to adjust the insertion point if you prefer embedding gate first. waiting on your preference and any constraints i should match.
Originally posted by @onestardao in #8
Originally posted by @onestardao in #8