Architecture & InternalsKiến trúc & Nội tại
The system is character-agnostic by construction — character subjects are resolved dynamically via paths.py, so the public toolkit ships no corpus at all and still imports, compiles, and tests. Every framework owns exactly one write-root and communicates via an event bus, never through cross-domain file writes.Hệ thống character-agnostic theo cấu trúc — nhân vật được resolve động qua paths.py, nên toolkit công khai ship không corpus nào mà vẫn import, compile, và test. Mỗi framework sở hữu đúng một write-root và giao tiếp qua event bus, không bao giờ qua ghi file chéo miền.
7 write-roots — one per framework7 write-root — một cho mỗi framework
Each framework owns exactly the directories listed. Cross-domain writes are banned (Rule 12) — if a framework needs another's data, it fires an event and waits for the response.Mỗi framework sở hữu đúng những thư mục được liệt kê. Ghi chéo miền bị cấm (Rule 12) — nếu một framework cần dữ liệu của framework khác, nó phát sự kiện và chờ phản hồi.
| FrameworkFramework | Write-root(s)Write-root | PurposeMục đích |
|---|---|---|
| MAT | docs/materials/ | Evidence ingestion, CRAAP scores, T1–T5 tier filesThu nhận bằng chứng, điểm CRAAP, file bậc T1–T5 |
| PSY | docs/profiles/ · docs/references/ · docs/graph/ | 25-file profile schema, clinical references, knowledge graphSchema hồ sơ 25-file, reference lâm sàng, đồ thị tri thức |
| CRE | assets/ | Platform-native content packages ({platform}/{YYMMDD}-{slug}/)Gói nội dung gốc nền tảng ({platform}/{YYMMDD}-{slug}/) |
| GRO | docs/profiles/*/growth/ | Career trajectory, competency maps, mentoring recordsQuỹ đạo sự nghiệp, bản đồ năng lực, hồ sơ cố vấn |
| EVL | docs/rubrics/ · docs/profiles/*/eval/ | Versioned rubrics, evidence-cited scorecardsRubric có phiên bản, scorecard trích nguồn bằng chứng |
| ORC | .claude/ | Event routing, session state, decisions log, agent memoryĐịnh tuyến sự kiện, trạng thái phiên, nhật ký quyết định, bộ nhớ agent |
| COM | .claude/ (shared; utility-only)(dùng chung; chỉ tiện ích) | Git hygiene, health monitoring, rules validation, skill analyticsVệ sinh git, giám sát sức khỏe, kiểm rule, phân tích skill |
platform_lib — shared Python toolkitplatform_lib — bộ toolkit Python dùng chung
Shared Python helpers under .claude/scripts/platform_lib/. Skills import these directly; they are not addressable via the skill catalog. The design principle: scripts gather deterministically (may over-flag); the LLM judges. Never delegate reasoning to scripts.Helper Python dùng chung dưới .claude/scripts/platform_lib/. Skill import trực tiếp; chúng không địa chỉ được qua catalog skill. Nguyên tắc thiết kế: script gom tất định (có thể over-flag); LLM phán xử. Không bao giờ giao lập luận cho script.
- Project root + character resolution from
characters.yaml.Gốc dự án + resolve nhân vật từcharacters.yaml. - All framework scripts resolve paths through here — never hardcode character names.Mọi script framework resolve path qua đây — không bao giờ hardcode tên nhân vật.
- Validates rubrics + scorecards against
.claude/schemas/at runtime.Validate rubric + scorecard theo.claude/schemas/lúc chạy. - Rejects malformed EVL output before it reaches the verdict cache.Từ chối đầu ra EVL sai cấu trúc trước khi đến cache phán quyết.
- Regex scanner for 80+ clinical terms — over-flags (by design); LLM decides relevance.Scanner regex cho 80+ thuật ngữ lâm sàng — over-flag (theo thiết kế); LLM quyết độ liên quan.
- Used by
psy:ref-auditandpsy:ref-scan.Dùng bởipsy:ref-auditvàpsy:ref-scan.
- Atomic learnings CRUD with confidence scoring — backs
orc:agent-memory.CRUD học nguyên tử có chấm độ tự tin — hậu thuẫnorc:agent-memory. - Append-only JSONL; never in-place edits.JSONL chỉ-nối; không bao giờ sửa tại chỗ.
- Consolidated sink root + auto script-metrics + crash excepthook.Gốc sink hợp nhất + auto script-metrics + excepthook crash.
- Fail-open: a telemetry error never blocks a skill run.Fail-open: lỗi telemetry không bao giờ cản chạy skill.
profile_stats— file inventory + git hash cache validation.profile_stats— kiểm kê file + xác thực cache hash git.formatters— markdown tables, JSON output, severity badges.formatters— bảng markdown, đầu ra JSON, huy hiệu mức độ.
4-layer knowledge graphĐồ thị tri thức 4 lớp
The knowledge graph lives at docs/graph/ and is owned by PSY (it models profile relationships). orc:graph queries it via seven platform_lib modules. Layers are incremental — each builds on the last.Đồ thị tri thức nằm ở docs/graph/ và do PSY sở hữu (nó mô hình hóa các quan hệ hồ sơ). orc:graph truy vấn nó qua bảy module platform_lib. Các lớp là tăng dần — mỗi lớp xây trên lớp trước.
Layer 1+2 — CoreLớp 1+2 — Lõi
knowledge_graph.pyFile-graph over profiles + relationships. get_graph, graph_context, validate_graph. NetworkX-backed. SHA256+JSON node-link cache (lazy/incremental via knowledge_graph_cache.py).Đồ thị file trên hồ sơ + quan hệ. get_graph, graph_context, validate_graph. Dựa trên NetworkX. Cache node-link SHA256+JSON (lười/tăng dần qua knowledge_graph_cache.py).
Layer 3 — Cross-lingualLớp 3 — Đa ngôn ngữ
knowledge_graph_embeddings.pybge-m3 + Gemini fallback: embed_corpus, cached_embedding_edges. Enables semantic similarity across EN/VI content without language mismatch.bge-m3 + Gemini fallback: embed_corpus, cached_embedding_edges. Kích hoạt tương đồng ngữ nghĩa xuyên nội dung EN/VI không lệch ngôn ngữ.
Analytics — NetworkXPhân tích — NetworkX
knowledge_graph_analytics.pycentrality / community / find_paths / structural_holes. Size-gated (≥500 nodes). Used by orc:graph analytics|centrality|community|path.centrality / community / find_paths / structural_holes. Gate kích thước (≥500 node). Dùng bởi orc:graph analytics|centrality|community|path.
Advisory — taggedTư vấn — được gắn thẻ
knowledge_graph_advisory.pyAll outputs tagged authoritative:false + owning_skill. Feeds psy:ref-audit, psy:timeline-sync, psy:propagate as optional inputs — the consuming skill stays source-of-truth.Mọi đầu ra gắn authoritative:false + owning_skill. Cung cấp cho psy:ref-audit, psy:timeline-sync, psy:propagate như đầu vào tùy chọn — skill tiêu dùng vẫn là nguồn sự thật.
knowledge_graph_viz.py — orc:graph visualize renders an interactive focus-graph as a standalone HTML file. The L3 MCP semantic memory graph is intentionally not built (deferred at Batch 5, OQ#7): the two needs it would serve are already covered by the file-graph + JSONL event streams.Hình ảnh hóa HTML dark-theme Pyvis qua knowledge_graph_viz.py — orc:graph visualize render đồ thị tập trung tương tác thành HTML độc lập. Đồ thị bộ nhớ ngữ nghĩa MCP L3 cố tình chưa xây (hoãn ở Batch 5, OQ#7): hai nhu cầu nó phục vụ đã được đáp bởi file-graph + luồng sự kiện JSONL.The core design principleNguyên tắc thiết kế cốt lõi
The self-contained .claude/ treeCây .claude/ tự chứa
Everything needed to run the system is under .claude/. No global install, no dashboard, no external server. The project is self-contained — the venv at .claude/skills/.venv/ is the only Python runtime needed.Mọi thứ cần để chạy hệ thống nằm dưới .claude/. Không cài global, không dashboard, không server ngoài. Dự án tự chứa — venv tại .claude/skills/.venv/ là runtime Python duy nhất cần.
- 7 framework dirs:
orc-*·psy-*·cre-*·gro-*·mat-*·com-*·evl-*7 thư mục framework:orc-*·psy-*·cre-*·gro-*·mat-*·com-*·evl-* - Each skill:
SKILL.md+README.md+GUIDE-EN.md+GUIDE-VI.mdMỗi skill:SKILL.md+README.md+GUIDE-EN.md+GUIDE-VI.md _framework-shared/— shared references + build scriptsreference dùng chung + build script.venv/— project-local Python runtimeruntime Python cục bộ dự án
- 7 framework-domain + 13 dev-engineer agent specs7 domain-framework + 13 agent dev-engineer spec
- Each is a Markdown file with role + tool permissionsMỗi cái là file Markdown với vai trò + quyền tool
gateguard-profile-protect.cjspii-guard-on-write.cjsrebuild-knowledge-graph.cjs- + 7 more telemetry/observe hooks+ 7 hook telemetry/observe khác
- 10 schemas — rubrics + scorecards + EVL verdicts10 schema — rubric + scorecard + phán quyết EVL
- Validated at runtime by
schema_validator.pyValidate lúc chạy bởischema_validator.py
platform_lib/— 10+ shared Python modulesplatform_lib/— 10+ module Python dùng chung- 7 knowledge-graph modules + non-KG utilities7 module knowledge-graph + tiện ích non-KG
- CK-origin dev rules (team-coordination, primary-workflow, orchestration-protocol, etc.)Rule dev CK-origin (team-coordination, primary-workflow, orchestration-protocol, v.v.)
- Separate from framework domain rules at
docs/rules/Riêng biệt với rule domain framework tạidocs/rules/
JSON schemas & runtime validationJSON schema & xác thực lúc chạy
Rubrics and scorecards are validated at runtime — evl:validate runs the check and schema_validator.py fails closed on structural violations. The token below is injected by the build pipeline with live schema stats:Rubric và scorecard được validate lúc chạy — evl:validate chạy kiểm và schema_validator.py fail-closed khi vi phạm cấu trúc. Token bên dưới được build pipeline chèn với thống kê schema trực tiếp:
Schema validation — 119 PASS, 0 FAIL, 3 SKIP ✓ All covered files conform to their schema. PASS — exit 0
Rubric schemaSchema rubric
4 built-in versioned rubrics (psychometric-big-five · role-casting-fit · clinical-risk-safety · relationship-compatibility) + imported/ for external ones. Each version is pinned — scorecards reference a specific version and fail validation if the rubric moves under them.4 rubric tích hợp có phiên bản (psychometric-big-five · role-casting-fit · clinical-risk-safety · relationship-compatibility) + imported/ cho rubric ngoài. Mỗi phiên bản được ghim — scorecard tham chiếu phiên bản cụ thể và thất bại validation nếu rubric thay đổi phía dưới.
Scorecard schemaSchema scorecard
Every criterion in a scorecard must carry a evidence_tier (T1–T5 from MAT) and a source_citation. Uncited criteria are flagged [UNVERIFIED] — they are counted and surfaced, never silently passed.Mọi tiêu chí trong scorecard phải mang evidence_tier (T1–T5 từ MAT) và source_citation. Tiêu chí không trích nguồn được gắn cờ [UNVERIFIED] — chúng được đếm và hiển thị, không bao giờ pass im lặng.
COM — utility framework (not a domain)COM — framework tiện ích (không phải miền)
COM handles cross-cutting concerns that no domain framework should own. It performs no domain writes — its only output surfaces are git history, session logs, and reports. Its 5 skills are invoked on-demand, not as part of the event cascade.COM xử lý các mối quan tâm xuyên cắt mà không framework domain nào nên sở hữu. Nó thực hiện không ghi miền — bề mặt đầu ra duy nhất là lịch sử git, log phiên, và báo cáo. 5 skill của nó được gọi theo-yêu-cầu, không phải là một phần của chuỗi sự kiện.
com:git
Project-aware git operations with conventional commits. Enforces: no corpus in commits, no .env, no credentials. Pre-commit secret scan is mandatory.Thao tác git nhận biết dự án với conventional commit. Ép: không corpus trong commit, không .env, không credentials. Quét secret trước commit là bắt buộc.
com:health-check
Session health monitoring — detects stalls, API errors, and process death for Claude Code subagents. Auto-invoked only when the user confirms monitoring or a health Monitor already runs; never auto-spawned silently.Giám sát sức khỏe phiên — phát hiện đình trệ, lỗi API, và chết tiến trình cho subagent Claude Code. Tự gọi chỉ khi người dùng xác nhận giám sát hoặc Monitor sức khỏe đang chạy; không bao giờ sinh im lặng.
com:rules
Validates changed files against docs/rules/*.md. Depends on orc:classify for risk classification. Output is advisory — surfaces violations, does not auto-revert.Validate file đã thay đổi theo docs/rules/*.md. Phụ thuộc orc:classify để phân loại rủi ro. Đầu ra là tư vấn — nêu vi phạm, không tự-hoàn-tác.
com:skill-analytics
11 read-only lenses over the skill corpus — usage frequency, script execution counts, error rates, profile-drift gate. Never writes to domain data.11 lăng kính chỉ-đọc trên corpus skill — tần suất sử dụng, số lượt script, tỷ lệ lỗi, gate profile-drift. Không bao giờ ghi vào dữ liệu miền.
com:release
Cuts a versioned distribution pack release — Keep-a-Changelog lock + pack.manifest.yaml version bump. Triggers the CI tag-release workflow that builds the pack and posts a GitHub Release.Cắt một bản release gói phân phối có phiên bản — khóa Keep-a-Changelog + bump phiên bản pack.manifest.yaml. Kích hoạt workflow CI tag-release để build gói và đăng GitHub Release.
MAT.integrated → PSY.refresh → CRE.recalibrate cascade. It does not own any profile, material, rubric, or asset data. Its scope is limited to: git hygiene, session observability, rule enforcement, skill observability, and release gating. If COM needs to reference domain data, it reads — it never writes.COM là lớp tiện ích, không phải miền. Nó không tham gia vào chuỗi MAT.integrated → PSY.refresh → CRE.recalibrate. Nó không sở hữu bất kỳ dữ liệu hồ sơ, tư liệu, rubric, hay asset nào. Phạm vi giới hạn ở: vệ sinh git, quan sát phiên, ép rule, quan sát skill, và gate release. Nếu COM cần tham chiếu dữ liệu miền, nó đọc — không bao giờ ghi.