11 KiB
Prompt For Claude — CASAN Phase 3 Wave 1 Real Core Improvements
You are working inside this repo:
/Users/thanhnguyen/Documents/AI/HarnessHkt/Harness_Hakathon/Output_CASAN5_REFINED/AINative_OKR_CASAN5
Read these files first:
docs/output/casan/phase3-push-to-90-plan.mddocs/output/casan/phase3-security-hardening-plan.mddocs/output/casan/phase3-preflight.mddocs/output/casan/app-evidence/MANIFEST.mddocs/output/output_logs/001-okr-web-app/pipeline-context.yaml
Execute Phase 3 Wave 1 as real engineering work. Do not produce demo-grade controls. Do not claim Phase 3 is complete.
Preflight Facts To Respect
- This is a git repo on branch
main. - Current preflight has untracked Phase 3 plan/evidence files.
- Mac runtime: Node v24.12.0, npm 11.7.0, Python 3.9.0.
- Linux server runtime: Ubuntu 26.04, Node v22.23.1, npm 11.17.0, Python 3.14.4, Ollama 0.30.11.
- Ollama runs on Linux server
192.168.1.5, not directly on Mac. - Mac accesses Linux Ollama through SSH tunnel:
http://127.0.0.1:11434. - Primary local model is
ollama:ornith:9b. ornith:9bdigest:a75697c145891910e312c95e4a9fc1ccb8653e5ef543b23b0403a4665b82fd91.gemma4:12bis also available but is not the declared primary.- Cloud env is unavailable:
ANTHROPIC_API_KEYandOPENAI_API_KEYare unset. - Current captured
npm testandnpm run buildfailed becauseprisma: command not found. - Current
npm audit --workspaces --audit-level=highfailed with 5 high and 7 moderate vulnerabilities.
Before implementing, resolve or clearly document the local dependency issue:
npm install
npm test
npm run build
Capture refreshed logs under:
docs/output/casan/phase3-evidence/wave1/
If tests/build still fail, stop implementation and write a blocker report. Do not build Phase 3 on a broken baseline unless the failure is explicitly scoped and accepted.
Absolute Integrity Rules
- Do not fake PASS, APPROVED, token usage, model verdicts, cost, drift, rollback, or audit results.
- Do not hardcode expected PASS results.
- Do not recycle sample token/cost numbers.
- Every test you add must be able to fail.
- Do not use
.specify/tests/generate-casan-demo-context.py. - Do not call regex-only logic semantic or model-based.
- Do not claim cloud/hybrid judging; current run is local-only unless real cloud keys are present.
- Do not claim H5 WORM/KMS; AWS/KMS/Object Lock is not configured.
- Do not claim target scores as achieved. Only write achieved scores after a real audit.
- Keep evidence under
docs/output/casan/phase3-evidence/wave1/. - If infrastructure is missing, write
BLOCKEDorSKIPPEDwith a reason. Do not mark it pass.
Core Modification Policy
For Phase 3, you are explicitly allowed and expected to modify core CASAN harness files when that is the correct engineering path.
This includes files under:
.specify/scripts/bash/*.specify/tests/*scripts/run-casan-pipeline.mjsscripts/casan-step.mjs
Do not avoid core changes by adding superficial wrappers if the real control belongs in the core harness.
This is not a demo-grade improvement task. Implement real controls in the actual execution path. If a claimed H1-H7 improvement is not wired into the path that the harness/pipeline actually uses, it does not count.
Rules for core changes:
- Do not weaken existing security, governance, tool-audit, rollback, drift, or agent-metrics checks.
- Do not edit tests to hide failures.
- Do not loosen adversarial tests.
- Do not replace real command execution with canned output.
- Do not hardcode PASS/APPROVED/verdict/token/cost values.
- Every core behavior change must include fail-able evidence:
- demonstrate the old weakness or failing case,
- implement the fix,
- demonstrate the case now fails closed or passes correctly.
- If a core script changes, run relevant existing harness checks afterward:
bash .specify/tests/run-casan4-harness-tests.shbash .specify/tests/adversarial-harness-tests.shbash .specify/scripts/bash/verify-audit-chain.shbash .specify/scripts/bash/verify-tool-audit.sh
- If a test cannot run because of environment constraints, record that as a blocker or limitation, not a pass.
For every core harness modification, document in docs/output/casan/phase3-wave1-results.md:
- file changed,
- behavior changed,
- threat/control improved,
- tests/evidence proving the change,
- compatibility result with existing harness tests.
Required Environment
Assume operator has opened this tunnel in another terminal:
ssh -N -L 11434:127.0.0.1:11434 thanhnv@192.168.1.5
Use:
export CASAN_MODEL_BACKEND=local
export CASAN_MODEL_PRIMARY=ollama:ornith:9b
export CASAN_MODEL_SECONDARY=ollama:ornith:9b
Verify before model work:
curl -sS http://127.0.0.1:11434/api/tags
curl -sS http://127.0.0.1:11434/api/generate \
-H 'Content-Type: application/json' \
-d '{"model":"ornith:9b","prompt":"Return exactly: OK","stream":false}'
Wave 1 Scope
Implement the foundation and minimum defensible security layer, wired into real execution paths.
A. Model Router Foundation
Create or modify as needed:
.specify/scripts/bash/model-router.sh.specify/scripts/bash/model-call.py- any core script that must call the router for the control to be real
Interface:
.specify/scripts/bash/model-router.sh <prompt-file> <out-json> [--role classify|judge|generate]
Required behavior:
- Support
ollama:<model>viaPOST http://127.0.0.1:11434/api/generate. - Use
ornith:9bas the primary local model. - Cloud backends may be implemented only if real env keys exist; otherwise report unavailable honestly.
- Output JSON must include:
textmodel_idroleinput_tokensoutput_tokenslatency_mstemperaturerouteverdictwhen role isclassifyorjudge
- For Ollama, use real
prompt_eval_countandeval_count. - Append real usage to
.specify/logs/level5/provider-usage.jsonl. - Do not recycle sample values.
- On backend/model failure, return nonzero with a clear error. Do not emit a fake fallback success.
B. WP-S1 Router Hardening
Implement hardening in the real model path:
- Delimit untrusted content:
<<<UNTRUSTED>>> ... <<<END_UNTRUSTED>>> classifyoutput must be exactlyINJECTIONorSAFE.judgeoutput must be exactlyAPPROVEDorREJECTED.- Any malformed model output must fail closed.
- Never log API keys, secrets, raw Authorization headers, or
.envcontents. - For future cloud egress, mask PII before sending. Since cloud keys are unset now, test this path as unavailable or with a local dry-run payload capture.
- Enforce endpoint allowlist:
api.anthropic.comapi.openai.com127.0.0.1:11434
- Reject arbitrary model URLs and metadata IP attempts.
- Use
temperature=0for classify/judge. - Write router audit/usage records without leaking prompt secrets.
C. Wire The Router Into Real Harness Paths
Do not leave the router as an unused utility.
For Wave 1, wire at least one real path:
-
H6 usage path:
- Ensure a real model-router call can feed
.specify/logs/level5/provider-usage.jsonl. - Ensure
agent-metrics.shcan consume real provider telemetry for a matching step where available.
- Ensure a real model-router call can feed
-
H7 fallback path:
- Replace fake fallback triggers like
bash -c "exit 9"inscripts/run-casan-pipeline.mjswith a real failing model-router primary route, then fallback toollama:ornith:9bonly if the model is available. - If the model is unavailable, record H7 fallback as blocked, not passed.
- Replace fake fallback triggers like
-
Optional H4/H3 path if feasible in Wave 1:
- Wire classify/judge into
security-check.shorcasan-step.mjsonly if you can prove fail-before/fix/pass in this turn. - If not feasible, document it as Wave 2 work. Do not claim H4/H3 model-based improvement.
- Wire classify/judge into
D. Fail-able Router Tests
Create or modify:
.specify/tests/phase3-model-router-tests.sh
Tests must cover:
ollama:ornith:9bgenerate works through tunnel, or fails with clear reason if tunnel unavailable.- Router records real
input_tokensandoutput_tokensfrom Ollama. - Classifier/judge malformed output fails closed.
- SSRF-like endpoint/model config is rejected.
- Fake API key pattern does not appear in
.specify/logs. - Cloud backend reports unavailable honestly while keys are unset.
- A deliberate failing primary route causes fallback only through the real router path, not
exit 9.
No hardcoded PASS.
E. Context Validation
Create or modify:
.specify/scripts/bash/context-validate.shscripts/run-casan-pipeline.mjsif needed to addgenerated_ator invoke validation in the real pipeline
Behavior:
- Default context:
docs/output/output_logs/001-okr-web-app/pipeline-context.yaml - Accept optional context path arg.
- Fail if any
artifact:path is missing. - Fail if any
trace_file:path is missing. - Warn if entries have no
generated_at. - If adding
generated_at, do it in the realappendContextpath.
Create fail/pass evidence:
- copy context to temp,
- inject one missing artifact path,
- show validator exits nonzero,
- run validator on real context and show pass.
F. Supply Chain Baseline
Current npm audit --workspaces --audit-level=high fails with 5 high vulnerabilities.
For Wave 1:
- Do not claim supply-chain gate green.
- Either fix high vulnerabilities without breaking app/test/build, or record them as a blocker for WP-S3.
- If you run
npm audit fixor upgrade major dependencies, run full app tests/build afterward and capture logs.
G. Wave 1 Results
Create:
docs/output/casan/phase3-wave1-results.md
Include:
- what was implemented,
- what was not implemented,
- infrastructure used,
- exact commands run,
- exact evidence files,
- real test results,
- core files modified and why,
- current blockers,
- remaining work for WP-A/B/C/D/E/F/G and WP-S2..S8,
- explicit statement that no average >90 score is claimed yet.
Required Commands And Evidence
Capture logs under:
docs/output/casan/phase3-evidence/wave1/
Run and capture:
npm install
npm test
npm run build
bash .specify/tests/phase3-model-router-tests.sh
bash .specify/scripts/bash/context-validate.sh docs/output/output_logs/001-okr-web-app/pipeline-context.yaml
If any core harness script changed, also run and capture:
bash .specify/tests/run-casan4-harness-tests.sh
bash .specify/tests/adversarial-harness-tests.sh
bash .specify/scripts/bash/verify-audit-chain.sh
bash .specify/scripts/bash/verify-tool-audit.sh
If baseline is green and model tunnel is available, run and capture:
node scripts/run-casan-pipeline.mjs
Deliverables
- Working Wave 1 code.
- Real evidence logs under
docs/output/casan/phase3-evidence/wave1/. docs/output/casan/phase3-wave1-results.md.- No fabricated evidence.
- No target score claimed as achieved.
If blocked, stop and write a precise blocker report instead of manufacturing evidence.