Commit Graph
100 Commits
Author SHA1 Message Date
thanhnv 6804fd14f4 fix: distinguish configuration from hook trust 2026-07-24 16:39:17 +07:00
thanhnv a7647887ca fix: clarify optional integration status 2026-07-24 16:36:17 +07:00
thanhnv cc666db9de feat: support Codex and Claude local surfaces 2026-07-24 16:33:21 +07:00
thanhnv 34a6b013c0 fix: harden Codex hook finalization 2026-07-24 13:06:23 +07:00
thanhnv bfebfa9d39 feat: add production init wizard UX 2026-07-24 12:30:37 +07:00
thanhnv eb3525456f feat: add production Core runtime modes 2026-07-24 12:16:11 +07:00
thanhnv e359989a74 fix: fully clean project adoption artifacts 2026-07-24 11:40:29 +07:00
thanhnv 114340c719 feat: harden CASAN production install lifecycle 2026-07-24 11:11:44 +07:00
thanhnv c7671ab198 optimize redme 2026-07-23 23:50:09 +07:00
thanhnv 93ffae93a8 optimize redme 2026-07-23 23:36:43 +07:00
thanhnv 2ca1eabca9 optimize docs 2026-07-23 23:30:43 +07:00
thanhnv a6c3a5d02f Update CASAN usage guide 2026-07-23 23:07:38 +07:00
thanhnv ce708fafe5 Add selectable CASAN IDE integrations 2026-07-23 23:04:54 +07:00
thanhnvandClaude Opus 4.8 ff4e9d5a53 feat(install): level-aware casan init + merge-safe adoption + hub guardrail
Answers the 3 adoption questions (Plan-21 follow-up):

1) LEVEL SELECTION (4 packaging levels, packaging/levels.json):
   - install.sh --level core|devkit; platform refused (preview service),
     enterprise refused (future). Level recorded in .casan-level.
   - casan init --level 1..4: L1=gate+Plan-20 hooks only; L2=+CI+domain-pack;
     L3=L2 base+preview note; L4=refused. New `casan level show|set`.
   - levels.json core now includes adapters/ + schemas/ + install scripts.

2) EXISTING SHELLS (agents/skills): init MERGES Plan-20 hooks into an existing
   .claude/settings.json and .codex/{hooks.json,config.toml} idempotently
   instead of clobbering — preserves the project's own hooks/agents/skills and
   unrelated keys. Re-running never duplicates the CASAN hook.

3) NO RE-INDEX / NO SHELL REWRITE: init only adds config; it does not parse or
   index code and does not rewrite the project shell.

Safety fixes after a test accidentally ran init in the real repo:
   - launcher shim now SELF-LOCATES its install from its own path (no ambient
     CASAN_HOME cross-talk).
   - casan init REFUSES to adopt a CASAN source hub into itself (--force to
     override), so the Plan-20 hooks can't block the developing agent.
   - test always runs init inside throwaway dirs; +source-hub guard test.

hybrid-install-tests.sh: 41/41 PASS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 22:00:46 +07:00
thanhnvandClaude Opus 4.8 8450f8ca1a feat(install): Plan-21 hybrid global install + casan init (pin+verify)
Adopt CASAN like a normal tool (codegraph-style): install the harness ONCE
per machine, then `casan init` per project writes CONFIG ONLY — the harness
is no longer copied into every repo.

- install.sh / install.ps1: global bootstrap (curl|sh / irm|iex or local
  source). Installs harness to $CASAN_HOME/versions/<ver>, writes a `casan`
  launcher that resolves the shared harness + the current project's .specify,
  and records a gate-code integrity hash. CASAN_NO_PATH_LINK for tests.
- harness_hash.py: deterministic content hash over gate code (scripts/bash,
  scripts/python, security, level5) — the pin+verify anchor.
- casan-init.py: `casan init` writes .casan/{config,version.lock,agentic.env},
  .specify/ marker, and the Plan-20 client hooks — no harness copy. `verify`
  recomputes the harness hash LIVE and compares to the project pin (drift/
  tamper -> rc 3), preserving the Plan-16 trusted-gates guarantee off-repo.
- bin/casan: new `init` and `verify-harness` commands.
- hybrid-install-tests.sh: 21/21 (install, config-only init, no-copy, pin,
  verify ok, tamper drift, bridge runs against project state via global harness).
- docs: CASAN_INSTALL_HYBRID.md + Plan-21.

The path model (casan-paths.sh) already separated harness/state/domain roots,
so this is installer + init, not a core rewrite. Remote dist tarball, real
Windows run, and signed .harness-hash are the documented next steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 21:26:54 +07:00
thanhnvandClaude Opus 4.8 f6d28a3163 feat(harness): Git Bash + graceful degradation for Windows agentic bridge
Wide-deployment Windows path without WSL2. The agentic bridge already runs
on native Python + PowerShell; the only bash dependency is the H4/H2 gate
scripts, which run under Git Bash (Git for Windows) — much lighter than WSL2.

- h4_scan now returns a status (ok|blocked|timeout|unavailable). Timeout stays
  FAIL-CLOSED (block/deny). "unavailable" (no bash / gate missing) DEGRADES the
  turn to observed_only and does NOT block the developer — never silently
  certifies without a working gate.
- bash interpreter is configurable via CASAN_AGENTIC_BASH; gates use it.
- doctor reports bash_available / gates_runnable + a remediation warning, and
  stays green (degraded, not failed) when bash is absent.
- tests: +4 no-bash cases (degrade to observed_only, tool still allowed,
  non-certified finalize, injection still blocked when bash present). 34/34.
- docs: Windows guide + security guide now point to Git Bash, not WSL2, and
  document the timeout-vs-unavailable distinction.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 20:52:02 +07:00
thanhnvandClaude Opus 4.8 4bb184b935 feat(harness): implement Plan-20 transparent agentic client bridge
Wave 0 + Wave 1 core of the transparent agentic-client integration: a
developer types prompts normally in Claude Code / Codex while every
certified turn still carries a full H1->H7 trace and an H6 record.

- agentic_bridge.py: stdlib-only lifecycle state machine (begin/pre-tool/
  post-tool/telemetry/finalize/abort + report/doctor). Single-model
  invariant (never calls a model), fail-closed at the side-effect point,
  admission TTL + canonical-project/session binding, atomic state under
  .specify/state/agentic-sessions/, secret redaction, null-not-zero H6.
- agentic-lifecycle.schema.json: client-agnostic JSON contract.
- adapters/claude-code + adapters/codex: thin hook renderers + config
  templates that call the core bridge.
- phase-agentic-bridge-tests.sh: C1-C12 acceptance + threat suite (30/30).
- devkit templates/{claude,codex} + windows/install-agentic.ps1
  (install/doctor/uninstall with manifest, path-safe).
- docs/casan Windows + security/bypass guides; plan status -> IMPLEMENTED.
- harden generate-agentops-dashboard.py aggregation against null H6 costs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 20:44:07 +07:00
thanhnv 0cc43d94d3 plan: update plan20 2026-07-22 00:20:12 +07:00
thanhnv 6faf589694 docs(devkit): ship Windows adoption guides 2026-07-21 23:51:03 +07:00
thanhnv 7b2ba60a3a feat(devkit): enforce governed prompt adoption 2026-07-21 23:40:26 +07:00
thanhnv 4d5dca9400 feat(control-panel): embed H6 telemetry in goal view 2026-07-21 23:38:59 +07:00
thanhnv 4b6819f578 update report h6 2026-07-20 23:47:09 +07:00
thanhnv f462079435 feat: casan chat optz 2026-07-19 12:14:12 +07:00
thanhnv 709b6cccd6 feat: appove and go 2026-07-19 09:37:16 +07:00
thanhnv 13fae3e6c3 fix template, remove okr, use casan.* 2026-07-18 16:45:31 +07:00
thanhnv 0dfd1742d3 fix(local-idp): prevent oidc token exchange timeout 2026-07-18 14:11:40 +07:00
thanhnv ffff800295 feat(control-panel): add oidc account switching 2026-07-18 14:05:35 +07:00
thanhnv 03ddeb7123 fix(control-panel): sign strict goal approvals via oidc 2026-07-18 13:59:15 +07:00
thanhnv c0a6dbc25f fix: build patches from complete target context 2026-07-18 13:44:20 +07:00
thanhnv 850be145d7 fix: keep h2 patch repair on direct codex 2026-07-18 12:20:22 +07:00
thanhnv 1e5cfb341c fix: complete streamed patch repair responses 2026-07-18 12:14:02 +07:00
thanhnv 659ed09839 fix: make h2 patch repair failures diagnosable 2026-07-18 12:04:32 +07:00
thanhnv 61a8253679 feat: route codex patch repair through responses api 2026-07-18 11:53:24 +07:00
thanhnv 4f8a53bda9 fix: strengthen goal patch repair routing 2026-07-18 11:36:03 +07:00
thanhnv f23fb98953 fix: validate and size governed patch outputs 2026-07-18 11:29:37 +07:00
thanhnv 36b6454b8d fix: include git in goal orchestration runtime 2026-07-18 10:43:20 +07:00
thanhnv e17a373da6 fix: prioritize direct providers for goal patch recovery 2026-07-18 10:32:06 +07:00
thanhnv 049f0c9b04 feat: visualize governed goal progress live 2026-07-18 10:19:26 +07:00
thanhnv efb5a62f29 fix: keep goal failure reasons gate-specific 2026-07-18 10:04:55 +07:00
thanhnv 1ffe5fe3df fix: retry invalid goal patch contract once 2026-07-18 09:57:05 +07:00
thanhnv 9785e13c82 feat: export aggregate Prometheus metrics 2026-07-18 09:25:56 +07:00
thanhnv 083a1de875 docs: add external security review engagement scope 2026-07-18 09:21:42 +07:00
thanhnv 777ce342fd ci: avoid setup-node cache cleanup deadlock 2026-07-18 09:19:34 +07:00
thanhnv 4af81ccf40 ci: bound self-hosted runner gate duration 2026-07-18 09:12:44 +07:00
thanhnv d9ca8df2d6 fix: use named frontend workspace in CI 2026-07-18 09:08:19 +07:00
thanhnv e50714d622 feat: add tenant isolation pre-audit evidence 2026-07-18 09:04:39 +07:00
thanhnv 36158c5e34 docs: add certification and audited operations roadmap 2026-07-18 00:22:52 +07:00
thanhnv 2783a21338 docs: add Japanese production support escalation draft 2026-07-18 00:22:18 +07:00
thanhnv 8a676f0ad4 docs: add APPI data processing assessment template 2026-07-18 00:21:36 +07:00
thanhnv b921f25c57 feat: require rootless production sandbox runners 2026-07-18 00:19:53 +07:00
thanhnv 92c20e304c ci: publish verified evidence packs from Gitea runs 2026-07-18 00:18:36 +07:00
thanhnv 407d373b4e feat: gate upgrades with compatibility matrix 2026-07-18 00:17:45 +07:00
thanhnv d129ba60ef fix: require Vault audit signing in production 2026-07-18 00:15:38 +07:00
thanhnv 00963119f4 feat: add verified state backup and restore drill 2026-07-18 00:14:22 +07:00
thanhnv 881ee01691 feat: prepare CASAN paid PoC release package 2026-07-18 00:07:04 +07:00
thanhnv a2cca645dc feat: apply reviewed goal patches 2026-07-12 00:21:50 +09:00
thanhnv 159022c73f feat: create new project added 2026-07-11 22:42:42 +09:00
thanhnv 193a449829 feat: updade workspace 2026-07-11 15:56:31 +09:00
thanhnv 4fc72332f5 optz: Goal orchestrator 2026-07-11 12:18:59 +09:00
thanhnv b56f7d357e feat: harden control panel authentication 2026-07-10 23:48:12 +09:00
thanhnv 48b1186439 feat: orchestrate goals with local and cloud models 2026-07-10 23:35:30 +09:00
thanhnv 1345d4c930 feat: add live H1-H7 trace explorer 2026-07-10 23:17:23 +09:00
thanhnv 7cb592a32f feat: add local provider account connector 2026-07-10 23:05:24 +09:00
thanhnv adce7717f7 feat: connect chat to managed model providers 2026-07-10 17:40:44 +09:00
thanhnv ef51c90d91 docs: explain how to use CASAN for real projects 2026-07-10 17:20:34 +09:00
thanhnv b0ced79af5 feat: govern chat model selection by policy 2026-07-10 17:09:28 +09:00
thanhnv f8215cd2eb feat: onboard service desk as second CASAN project 2026-07-10 17:00:35 +09:00
thanhnv 040af64191 feat: enforce live supply chain provenance gates 2026-07-10 16:47:45 +09:00
thanhnv aa284e9bd4 feat: add production deployment handoff controls 2026-07-10 16:41:14 +09:00
thanhnv 7cea023dce feat: chat + optmz control panel 2026-07-10 16:26:30 +09:00
thanhnv d882a9dc23 feat: plan 18 2026-07-10 11:28:14 +09:00
thanhnv fafccc47ad feat: complete llm sourcegen plan 2026-07-09 00:59:28 +09:00
thanhnv c800f7edf7 feat: harden chat state by tenant 2026-07-08 23:38:22 +09:00
thanhnv b3b0544ba8 feat: certify codegen chat drafts through loop 2026-07-08 23:20:54 +09:00
thanhnv 780fe86273 feat: escalate chat approvals through inbox 2026-07-08 23:09:43 +09:00
thanhnv a029a51e72 feat: add command center chat loop widget 2026-07-08 22:58:02 +09:00
thanhnv 36af576f15 feat: add chat replay verification 2026-07-08 22:45:12 +09:00
thanhnv 49d0363c6a feat: certify chat operator turns through loop-run 2026-07-08 22:31:03 +09:00
thanhnv 004afa73c9 feat: add governed chat agent selection 2026-07-08 22:19:51 +09:00
thanhnv 06d8d31b16 chore: ignore chat runtime logs 2026-07-08 21:20:49 +09:00
thanhnv 5561bcf864 feat: add governed chat console 2026-07-08 21:14:40 +09:00
thanhnv 3be9970c15 feat: add control panel 2026-07-08 19:07:35 +09:00
thanhnvandClaude Opus 4.8 a07b15e489 docs(plans): Plan-13 Track 1 (read-only Ops Console) marked done in status trackers
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 17:28:35 +09:00
thanhnvandClaude Opus 4.8 94a7168362 chore: gitignore tsconfig.tsbuildinfo (build cache, not source)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 17:27:00 +09:00
thanhnvandClaude Opus 4.8 63dd44a11b feat(plan-13): read-only Ops Console (NestJS API + React UI) — Track 1
Real web Control Panel over CASAN harness telemetry (Level-3 casan-platform component).
Read-only ("Đọc ≠ Ghi"): no settings writes, no gate bypass. Management/RBAC/approval are
Track 2/3 (future, Plan-14). Additive — harness gate untouched (64/0/3).

packages/casan-control-panel/
- backend/ (NestJS, ESM, /api/v1 + ok() envelope): TelemetryReader (jsonl/json, missing→[],
  never fabricates) + TelemetryService (aggregations mirroring generate-agentops-dashboard.py)
  + endpoints overview/runs(+:traceId)/governance/security/incidents/tools/traceability/
  drift/cost, and /healthz (stale-aware 200/503, fail-loud like dashboard-server.py). App
  root + telemetry paths resolve via casan-paths-style marker walk-up (.specify OR
  packages/casan-harness) + honor CASAN_DASHBOARD_* env. Binds 127.0.0.1; refuses
  non-loopback under CASAN_PROFILE=prod. @Inject token so DI works under tsc AND tsx.
  Tests (node native runner) 7/0: reader parse/missing, app-root, overview shape on real
  repo state, freshness/stale fail-loud.
- frontend/ (React+Vite+Tailwind+TanStack, port 5174, proxies to :3010): AppLayout +
  Sidebar + Header (LIVE/STALE badge from /healthz) + pages Overview/Runs/Governance/
  Security/Incidents/Traceability. axios client unwraps ok() envelope. build green.

Wiring: root workspaces + `console:*` scripts. packaging/levels.json + casan-platform
README: platform preview now lists the Ops Console as an implemented component.

Verified: backend build + test 7/0; frontend tsc + vite build; API serves REAL data
(runs=6, provider_tokens=5556, action_blocks=7); /healthz 503 stale → 200 after touch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 16:59:56 +09:00
thanhnvandClaude Opus 4.8 98d699d844 ci(release): auto-publish split bundles to Gitea package registry on version tags
.gitea/workflows/release.yml — on push tag v*: assert tag==VERSION, run the governance
gate (must be green), build core/devkit/platform-preview/all-in-one-demo (enterprise
skipped/refused), then PUT each .tar.gz (+.sha256) to the Gitea generic package registry
using ${{ secrets.GITEA_TOKEN }}. Portable via GITHUB_SERVER_URL/OWNER. Guide updated with
the one-time secret setup + release flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 16:06:28 +09:00
thanhnvandClaude Opus 4.8 6cb96ce249 fix(governance): commit policy-bundle with packages/casan-harness paths (+ re-signed manifest)
The policy bundle listed the 8 governed policy files under .specify/... (pre-restructure).
After the move they live in packages/casan-harness/. Repoint all 8 paths and re-sign the
manifest. This MUST be committed as its own step: phase-sec09/sec29 cleanup runs
`git checkout -- .specify/level5/central-governance/`, which restored the bundle to HEAD on
every gate run — so the fix only sticks once HEAD itself carries the corrected, re-signed
bundle. sign-policy-bundle verify → POLICY_SIGNATURE_VALID.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 15:57:33 +09:00
thanhnvandClaude Opus 4.8 8c20cfde9f feat(packaging): level-based source hub — Core + DevKit packaging, Platform/Enterprise scaffold
Organize CASAN as a reusable source hub with SPLIT releases so downstream adopts only the
level it needs (packaging/levels.json is the single source of truth).

Implemented now:
- Level 1 Core: bin/casan CLI (run/gate/test/verify/reuse/dashboard) + VERSION.
- Level 2 DevKit: packages/casan-devkit (install.sh, Dockerfile.harness, templates:
  project scaffold, domain-pack, gitea-workflow).
- scripts/package-release.sh core|devkit|platform|all-in-one-demo — builds split bundles
  into dist/ (BUNDLE-MANIFEST + SHA256SUMS); platform is stamped PREVIEW/INCOMPLETE;
  enterprise (future) is REFUSED (exit 3, no fake-complete package). Bundles verified:
  extract → bin/casan works, deterministic + domain suites pass, casan reuse VALID.
- docs/packaging: CASAN_PACKAGING_PLAN + ADOPTION + CI + DOMAIN_PACK + GITEA_PACKAGE + DOCKER.

Structure + docs only:
- Level 3 packages/casan-platform (dashboard exists; control-panel/viewers pending).
- Level 4 packages/casan-enterprise (RBAC/tenant/KMS/WORM/approval exist in core; governed
  console pending). No Chat Console/RBAC-console/tenant-console/model-mgmt built in this task.

Harness change (enables extracted bundles to self-resolve): casan-paths.sh + the Python
project_root() walk-ups now accept a second root marker `packages/casan-harness` in addition
to `.specify`, so a freshly-unpacked core/devkit/demo bundle (no `.specify` yet) roots
correctly and creates state on first run. In an adopted repo `.specify` still matches first.
policy-bundle.yaml paths corrected to packages/casan-harness (re-signed). Full gate 64/0/3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 15:55:37 +09:00
thanhnvandClaude Opus 4.8 4918012199 docs(plans): sync roadmap status + paths to post-restructure state
- Plan-01 marked ✅ DONE (INDEX table + P3 tier + BACKLOG row + plan header).
- Plan-06 / Plan-12 dependency on 01 satisfied → 🔓 unblocked (headers + BACKLOG rows).
- Repoint command/path refs in all plans (except Plan-01's migration narrative):
  .specify/{scripts,tests,security,config,templates,governance} -> packages/casan-harness/...;
  golden-runs/traceability-map/docs-input -> apps/okr/domain/...; `cd AINative_OKR_CASAN5`
  -> `cd $(git rev-parse --show-toplevel)`; fix relative links + Plan-13 control-plane location.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 14:57:01 +09:00
thanhnvandClaude Opus 4.8 09ac4c674d docs: restore FPT_CASAN_Full + harness-assessment into docs/notes
Two reference notes kept (per review); other scattered root notes and optimize-docs
(competition/video material) remain in git history only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 14:49:31 +09:00
thanhnvandClaude Opus 4.8 fa3dd94c76 docs: restore casan-next-plans roadmap into docs/plans (was wrongly deleted)
The plan set (Plan-00..18, backlog/hardening/QA status, team allocation) is the ONGOING
roadmap, not a finished competition artifact — restored from history into docs/plans/.
Plan-01 (restructure) marked ✅ done; the rest remain to do.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 14:46:50 +09:00
thanhnvandClaude Opus 4.8 18997caf49 docs: align all documentation with the new repo structure
Update agent protocols (.claude/agents, .github/agents), guides, runbooks and READMEs
to the post-restructure layout: .specify/{scripts,tests,security,config,templates,
governance,memory,level5-config} -> packages/casan-harness/...; docs/input +
golden-runs + traceability-map -> apps/okr/domain/...; drop AINative_OKR_CASAN5/ prefix.
Runtime-state paths (.specify/logs, .specify/agentops, .specify/level5/central-governance)
kept as-is. Historical evidence under docs/output/ left untouched (immutable run records).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 14:36:27 +09:00
thanhnvandClaude Opus 4.8 36a4812ef3 refactor(structure): promote app to repo root + remove redundant workspace cruft
Standard production layout: the OKR app (was nested under AINative_OKR_CASAN5/) is now
the repository root. No more wrapper directory.

- Promote AINative_OKR_CASAN5/* -> repo root (backend/ frontend/ packages/ apps/
  .specify/ docs/ infra/ nginx/ scripts/ + configs). Merge tool dirs: .gitea (kept the
  active deploy ci.yml, added harness-ci.yml + runbooks), .claude (agents/commands +
  launch.json), .github moved up.
- Remove redundant: 00_SUBMISSION_PACKAGE, scattered root notes (FPT_CASAN_Full.md,
  tu-tuong-casan.md, casan-tu-sinh..., casan_harness_assessment.md, source-review...,
  README_CASAN5_REFINED.md), casan-next-plans/ and optimize-docs/ (competition/planning
  artifacts — roadmap + design history preserved in git log / commit messages).
- Update all references to the old layout:
  - .gitea/workflows/{ci,harness-ci}.yml, .github/workflows/{ci,deploy}.yml:
    working-directory .; drop AINative_OKR_CASAN5/ prefix; .specify/{tests,scripts}
    -> packages/casan-harness/... (.specify/logs state kept)
  - .claude/launch.json, .gitea/*-runbook.md: path prefixes
  - CLAUDE.md, README.md: docs/input -> apps/okr/domain/input
  - policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest re-signed
- secrets-scan.sh: fixture excludes -> new package/domain paths.

Full gate from the new root: PASS=64 FAIL=0 SKIP=3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 13:26:36 +09:00
thanhnvandClaude Opus 4.8 7101af9fd4 feat(plan-01): Phase 4c — hard cutoff, remove .specify compat facade
Repoint every remaining literal `.specify/...` / `docs/input` reference to the real
package/domain location and delete all compat symlinks. The harness now runs purely via
packages/casan-harness/... with no .specify facade; .specify holds ONLY runtime state
(logs/, agentops/alerts.log, level5/central-governance).

Refs fixed (Phase 0.5 only caught `$VAR/.specify/` — these were bare/`__file__`/literal):
- secrets-scan.sh: scan-target excludes -> packages/casan-harness/... (+ apps/okr/domain/corpus)
- loop_common.py: loop-policy.yaml -> harness config (package-relative)
- evidence-pack-build.py: judge-gate test + traceability-matrix.py -> harness/sibling
- phase10-traceability: REQ -> $CASAN_DOMAIN_ROOT/input
- run-casan-pipeline.mjs: model-fallback/drift-detect/rollback-manager -> HARNESS_BASH,
  golden -> GOLDEN_PLAN (apps/okr/domain), with .specify/logs state kept
- casan-step.mjs: requirement fallback restored to docs/input for hermetic sandboxes
- descriptive config (tool-registry/harness-package/drift-policy/hallucination/risk-registry/
  loop-policy.schema + docstrings) repointed for accuracy
- policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest regenerated +
  re-signed (POLICY_HASHES_VALID files=8, POLICY_SIGNATURE_VALID)

Removed 22 .specify code/config symlinks + docs/input symlink.
Full gate via packages path, NO facade: PASS=64 FAIL=0 SKIP=3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 12:28:37 +09:00
thanhnvandClaude Opus 4.8 e891981b59 feat(plan-01): Phase 4b — external callers to packages paths + registry (Task 1.7)
Point the canonical entry points at the new package layout; the .specify compat facade
is retained as an intentional backward-compat layer (see below).

- .gitea/workflows/{ci,harness-ci}.yml: invoke packages/casan-harness/scripts/bash|tests
  (state paths .specify/logs kept). CI now runs on the new structure.
- infra/local-prod/docker-compose.yml: dashboard-server.py -> packages path (logs/alerts
  env stay under .specify state).
- scripts/casan-step.mjs + run-casan-pipeline.mjs: resolve the harness under
  packages/casan-harness, falling back to .specify so the adversarial/sourcegen sandboxes
  (which stage a .specify/ tree) keep working; requirement input prefers apps/okr/domain/input.
- project-registry.json: record the new layout (harness_root, state_root, governance_root,
  per-project domain_root) so Plan-06 can register a second app with its own domain.
  verify-harness-reuse.sh already resolves via CASAN_HARNESS_ROOT -> HARNESS_REUSE_VALID (3 projects).

Facade decision: the .specify/{scripts,tests,security,...} symlinks are KEPT as a
documented compat layer. A full hard cutover (removing them) still needs ~15 literal
`.specify/...` refs repointed (loop_common/evidence-pack/secrets-scan config+test paths,
run-casan-pipeline step scripts, and the signed policy-bundle.yaml path list which then
needs manifest regen + re-sign). That is a scoped follow-up; the physical separation
(code in packages/, domain in apps/, packages holds no domain data, single CASAN_* path
indirection) is complete and the full gate is green via BOTH entry paths: PASS=64 FAIL=0 SKIP=3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 11:36:24 +09:00
thanhnvandClaude Opus 4.8 3adc48ed82 feat(plan-01): Phase 4a — make harness location-independent (facade-free capable)
Resolve every root by marker walk-up instead of a fixed depth that only lands on the
app via the .specify compat symlink, so the harness runs correctly when invoked by its
real packages/casan-harness path — proven by a full gate run via that path: 64/0/0.

- 95 scripts/tests: PROJECT_ROOT/ROOT "$SCRIPT_DIR/../.."-style computations -> $CASAN_APP_ROOT.
- 6 leaf scripts (infra-lab, context-validate, secrets-scan, path-guard, toolchain-verify,
  phase2-sourcegen) now source casan-paths + use CASAN_APP_ROOT.
- run-casan4: source casan-paths as a package sibling (facade-independent), PROJECT_ROOT=CASAN_APP_ROOT.
- 8 Python files: project_root()/REPO_ROOT/bundle_root walk UP for the .specify marker
  (control-plane-settings, loop_common, model-call, context-compress, test-integrity,
  bundle-integrity, traceability-matrix; generate-* fixed earlier).
- evidence-pack-build.py + traceability-matrix.py: domain refs -> apps/okr/domain
  (input/, corpus/redteam-vectors.jsonl, traceability-map.json).
- ci-harness-gate.sh: export CASAN_TESTS_DIR/CASAN_TEST_MANIFEST/CASAN_BUNDLE_ROOT so the
  integrity Python resolves via the harness root regardless of invocation path; ROOT=CASAN_APP_ROOT.
- Remove the domain compat symlinks from packages/casan-harness/security (redteam-corpus,
  redteam-vectors, benign-corpus) — packages now holds NO domain data.

Both invocation paths pass (compat facade still present): .specify/... and packages/...

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 10:50:50 +09:00
thanhnvandClaude Opus 4.8 f2ea5590b1 feat(plan-01): Phase 3 — split domain OKR data into apps/okr/domain
Separate per-project domain data from the reusable harness so packages/casan-harness
holds no domain artifacts. Domain data physically relocated to apps/okr/domain, with
compat symlinks at the old paths (Python + app + evidence-log refs keep resolving).

Moved -> apps/okr/domain (+ compat symlink at old path):
  golden-runs/           (was .specify/level5/golden-runs)
  corpus/{redteam-corpus.jsonl,redteam-vectors.jsonl,benign-corpus/}
                         (was packages/casan-harness/security/*)
  traceability-map.json  (was .specify/traceability-map.json)
  input/                 (was docs/input — OKR requirement/architecture)

casan-paths.sh: add CASAN_DOMAIN_ROOT (apps/okr/domain; env-overridable so Plan-06 can
point a second app at its own domain; falls back to .specify pre-split).

Harness bash refs repointed to $CASAN_DOMAIN_ROOT: run-casan4 (golden), phase3-redteam
(corpus), phase-h4-multilingual/split-inject (benign-corpus), phase10-traceability (map),
benign-fp-report (corpus+vectors). Python + app refs still resolve via the compat
symlinks (repointed in Phase 4 when the symlinks are removed).

Full gate: PASS=64 FAIL=0 SKIP=3 (CASAN_CI_STEP_TIMEOUT_SEC=1200). A first gate run
crawled under host load avg ~30 (Ollama + system); re-run at lower load passed clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 10:01:15 +09:00
thanhnvandClaude Opus 4.8 d54d7f5f4c feat(plan-01): Phase 2 — relocate level5/agentops config + init-options to package
Move the harness-config files out of the mixed .specify/level5 and .specify/agentops
dirs (which also hold governance/domain/state) into packages/casan-harness, leaving a
per-file compat symlink at each old path. Runtime state and governance stay in place.

Moved (+ .specify symlink each):
  level5:   drift-policy.yaml kpi-schema.yaml model-fallback.yaml tool-registry.yaml
            harness-package.json project-registry.json provider-usage-sample.json
  agentops: alerts.yaml hallucination-tracking.yaml metrics.yaml rate-limits.yaml tracking.yaml
  top:      init-options.json
Stays in .specify: level5/central-governance (governance), level5/golden-runs (domain,
  Phase 3), agentops/alerts.log (state), traceability-map.json (domain, Phase 3).

Full gate: PASS=64 FAIL=0 SKIP=3 (CASAN_CI_STEP_TIMEOUT_SEC=1200).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 00:36:06 +09:00
thanhnvandClaude Opus 4.8 664bd1f00c feat(plan-01): Phase 1 — relocate harness code to packages/casan-harness (symlink facade)
Physically move the pure-code subtrees out of .specify into the package, leaving
compat symlinks at the old .specify/<dir> paths so every existing reference (internal
CASAN_HARNESS_ROOT + external CI/docker/mjs) keeps resolving. Runtime state stays put.

Moved (git mv): scripts/ tests/ security/ templates/ config/ governance/ memory/
  .specify/<dir>  ->  packages/casan-harness/<dir>   (+ .specify/<dir> symlink)
Stays in .specify (state/governance/domain, handled later): logs/ agentops/ level5/
  init-options.json traceability-map.json

Python `.resolve()` self-location followed the compat symlink into packages and lost
the app root; generate-casan-demo-context.py, generate-agentops-dashboard.py and
dashboard-server.py now walk UP for the `.specify` state marker instead of a fixed
parent depth (fixes "missing trace files" in run-casan4).

Full gate: PASS=64 FAIL=0 SKIP=3 (CASAN_CI_STEP_TIMEOUT_SEC=1200 — track-a ~450s runs
close to the 600s default and can tip over under load; this is timing variance, not a
regression — it passed cleanly with headroom). Runtime log/audit artifacts kept unstaged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 00:06:00 +09:00
thanhnvandClaude Opus 4.8 2c765c9a45 feat(plan-01): Phase 0.5 — path indirection via casan-paths.sh (no file moves)
Task 1.2: introduce a single path resolver so no harness script hardcodes
`.specify/...` scattered across the tree. casan-paths.sh resolves four roots
(HARNESS/STATE/GOVERNANCE/APP) by marker-based walk-up from its own location —
never `git rev-parse` (git root is the repo PARENT here, not the app dir).

- 101 bash scripts/tests: 238 hardcoded `$PROJECT_ROOT/.specify/...` refs rewritten
  to CASAN_HARNESS_ROOT (code) / CASAN_STATE_ROOT (logs,state) / CASAN_GOVERNANCE_ROOT.
  Sandbox test vars ($WORK/$TP/$FP/$T1_WORK) left untouched.
- Roots are NOT exported: each script/subprocess self-resolves from its own tree,
  matching the original per-script semantics and preserving hermetic sandbox isolation
  (node casan-step.mjs, copied telemetry/rollback scripts must not inherit real roots).
- Sandbox tests that copy a harness script now also copy casan-paths.sh (its new
  sibling dependency): adversarial (verify-audit-chain/verify-tool-audit/rollback) +
  track-a (security-check/telemetry-integrity).
- control-plane-settings.json reclassified as STATE (untracked runtime store).

Roots all still resolve to `.specify` in this monolithic layout, so behavior is
unchanged. Full gate: PASS=64 FAIL=0 SKIP=3 (adversarial 44/0, track-a 25/0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 22:07:41 +09:00