Files
CASAN/.claude/agents/protocols/tool-registry-policy.md
T
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

2.2 KiB

Danh mục và Giao thức Quản lý Công cụ (Tool Registry Policy)

Giao thức này quy định danh sách trắng các công cụ và câu lệnh hệ thống (Tools & CLI Commands) được phép thực thi tương ứng với từng loại Agent để đảm bảo nguyên tắc đặc quyền tối thiểu (Least Privilege).

1. Danh sách trắng công cụ (Tool Whitelist per Agent)

A. Boss Orchestrator (okr.bossbuiltin)

Được phép điều phối và chạy toàn bộ các chuỗi công cụ chuẩn bị và kiểm thử:

  • Read, Write, Edit, Glob, Grep (IDE Tools)
  • Các script hỗ trợ: .specify/scripts/bash/casan-harness.sh, security-check.sh, governance-check.sh, agent-metrics.sh
  • CLI Commands: npm install, npm run build, npm run start:dev, docker compose

B. Special Design/Specification Agents (srs, bd, specify, plan, dd, tasks)

Chỉ được phép làm việc trên các tệp tin tài liệu (Read-only on source code, Write-only on specification files):

  • Read (toàn bộ workspace)
  • Write, Edit (chỉ trên thư mục docs/ và specs/)
  • CẤM HOÀN TOÀN: Sử dụng công cụ Bash để thực thi shell command tùy ý.

C. Implementation Agent (speckit.implement)

Được quyền viết code và tự động xác minh lỗi:

  • Read, Write, Edit (trên toàn bộ workspace bao gồm backend/, frontend/)
  • Bash (chỉ giới hạn cho các lệnh: npm install, npm run build, npm test, npx prisma, git diff)

D. Testing & Quality Agent (okr.testkit, okr.reviewcode)

Được quyền chạy kiểm thử và review:

  • Read (toàn bộ workspace)
  • Bash (chỉ chạy lệnh kiểm thử: npm test, npm run test:cov, jest, mocha)

2. Quy tắc kiểm tra (Tool Access Guard)

  • Trước khi thực thi bất kỳ lệnh hệ thống nào thông qua Bash tool, script kiểm duyệt governance-check.sh sẽ phân tích cú pháp câu lệnh (Command Line Parsing).
  • Nếu lệnh chứa các từ khóa cấm hoặc hành vi gọi ứng dụng không nằm trong whitelist của Agent đang gọi, hành động sẽ bị Block và ghi nhận sự kiện vi phạm an toàn tool.