{"skill":{"slug":"tricore","displayName":"TriCore","summary":"TriCore Architecture - A deterministic (Code-First) three-layer memory and cognitive framework designed for low-resource servers/Agents. It includes the unde...","description":"---\nname: tricore\nversion: \"1.0.0\"\ndescription: TriCore Architecture - A deterministic (Code-First) three-layer memory and cognitive framework designed for low-resource servers/Agents. It includes the underlying memctl engine, system policy constraints (Linter), and a fully refactored suite of cognitive tools for planning (Planning), reasoning (ReAct), and self-evolution (Self-Evolution).\nauthor: Berton Han\nrepository: https://github.com/bertonhan/tricore\nallowed-tools:\n  - default_api:exec\n  - memory_search\n  - memory_get\n---\n\n# 🤖 Agent Usage Guide (Read First)\n\n**If you are the current AI Agent and have just been asked to load, use, or analyze this skill:**\n1. This is your fundamental operating system law. Your memory and state have been completely constrained under the TriCore architecture. You are **STRICTLY FORBIDDEN** from arbitrarily creating independent text files like `task_plan.md` or `findings.md` in the root directory!\n2. Your memory write operations must and can only be proxied by the command-line `python3 tools/memctl.py (capture/work_upsert/kb_append)`. When reading history, you **MUST** use the native semantic retrieval tool `memory_search` to fetch fragments.\n3. Please use this manual as your base operating instructions. If instructed to configure Cron or write system automation scripts, you must call `memctl.py lint` to test the scheme's legality after writing the commands.\n\n---\n\n# TriCore Architecture\n\n> **The underlying infrastructure of \"storage and computation decoupling\" built for true autonomous Agents.**\n\nTraditional Agent skills often carry their own \"memory baggage\" (such as generating `task_plan.md`, `reflection.md`, or scattered learning notes in the project root), leading to context silos and storage chaos.\n\n**TriCore** abandons the paradigm of arbitrarily reading and writing text based on LLMs, and instead adopts a **Code-First** deterministic state machine:\n1. **Unified Engine**: All memory additions, deletions, modifications, and queries must be routed through `tools/memctl.py`.\n2. **Three-Layer Storage**:\n   - **Brief (Layer 1)**: `MEMORY.md` (System-level micro-profile, storing only pointers and laws)\n   - **Living (Layer 2)**: `memory/state/WORKING.md` (Currently running task streams/lifecycle tracking)\n   - **Stable/Volatile (Layer 3)**: `memory/kb/*.md` (Accumulated knowledge base) & `memory/daily/*.md` (Temporary logs)\n3. **Retrieval First**: It is forbidden to directly pour huge files using the `read` tool; you must use semantic retrieval `memory_search` to fetch code snippets, greatly saving Tokens and protecting low-resource environments.\n4. **Hard Constraints (Linting)**: Features a native `memctl.py lint` mechanism; any Cron or Skill changes that break the architecture will be intercepted and reported as errors by the Linter.\n5. **System Compatibility (Compaction Hook)**: Automatically overrides OpenClaw's underlying `pre-compaction memory flush` prompt during installation, preventing HTTP 429 request burst death loops caused by unauthorized file writing attempts during Token compaction.\n\n---\n\n## 📦 Architectural Components\n\nThis skill package contains complete system components:\n\n1. **`tools/memctl.py`**: The core engine, containing subcommands like `ensure`, `capture`, `work_upsert`, `kb_append`, `lint`.\n2. **`install.sh`**: One-click installation script that automatically initializes directories and injects TriCore compliance policies into `POLICY.md`.\n3. **`cognitive-skills/`**: Three core cognitive skills refactored based on TriCore (as templates for your Agent to load):\n   - `planning-with-files.md`: A PEP planning system that discards detached task lists.\n   - `react-agent.md`: A ReAct loop based on persisting mental states to `WORKING.md`.\n   - `self-evolution.md`: An evolution system that completely detaches memory management and focuses on \"Code-level CI/CD\".\n\n---\n\n## 🧩 Core Dependencies & Runtime Requirements\n\nAs an underlying cognitive foundation, TriCore itself and its embedded three major cognitive skills have the following dependencies on the host environment:\n\n### 1. Hard Dependencies\n- **OpenClaw (v2026+)**: Must support native `memory_search` and `memory_get` tools (this is the retrieval basis for completely deprecating reading large files).\n- **Python 3.6+**: Python 3 must be installed in the host environment (used to execute the `tools/memctl.py` state engine).\n- **System Tools**: `bash`, `sed`, `grep` (used for regular expression parsing by the Linter and Hooks).\n\n### 2. Cognitive Skill Soft Dependencies\nIf you enable `cognitive-skills/self-evolution.md` (Self Code Evolution Skill), your Agent must have tentacles to explore outward, otherwise, it can only undergo \"hallucinated self-evolution\" in an internal infinite loop.\n\n- **🌟 `agent-browser` (Highly Recommended)**: \n  - **Function**: Enables the Agent to truly read GitHub source code, official API documentation, and the latest papers.\n  - **Installation**: You need to separately install OpenClaw's `agent-browser` skill, which provides WYSIWYG crawling and clicking capabilities based on a headless browser.\n- **Search Tools (`web_search` / `web_fetch`)**:\n  - **Function**: Acts as a lightweight fallback for the browser, used to quickly extract Markdown snippets from public web pages.\n- **Runtime Modification Permissions (`default_api:exec` & `default_api:write`)**:\n  - **Function**: The essence of the evolution skill is \"modifying code\"; if your Agent is running in a ReadOnly sandbox, evolution cannot occur.\n\n---\n\n## 🚀 Installation & Initialization (The 3-Step Setup)\n\nIn any completely new OpenClaw environment, executing the following command will deploy the TriCore architecture:\n\n```bash\n# Grant installation script permissions and execute\nbash ./install.sh\n```\n\n**`install.sh` executes in the following order:**\n\n### Step 1: Core Engine Deployment\n1. Creates standard directories like `memory/state/`, `memory/kb/`, `memory/daily/`.\n2. Deploys the `tools/memctl.py` engine to the current environment.\n\n### Step 2: Force Legacy MEMORY Migration (Agent Action Required)\nIn a low-resource architecture, a massive `MEMORY.md` full of conversation history and diaries is extremely fatal.\nThe script will automatically detect the current `MEMORY.md`:\n- If found to be too bloated (> 1500 bytes), it will be renamed and **moved to `memory/archive/legacy-MEMORY-<date>.md`**.\n- Then, a compliant **minimalist `MEMORY.md` template** will be rebuilt in the root directory.\n- **Agent Note: At this time, you need to actively use `read` to read the legacy backup file, and call `memctl.py` to redistribute this legacy** (facts into `kb/facts`, rules into `kb/playbooks`, logs into `daily`); it is **STRICTLY FORBIDDEN** to paste long texts intact back into the new MEMORY.md!\n\n### Step 3: System Global Linter Blockade Deployment\nThe script will inject a `[CRITICAL: TriCore Compliance]` top-priority defense line into the system's `POLICY.md`. Thereafter, all planning for disk-writing, state updating, and automated tasks executed by the Agent must all pass the `memctl.py lint` regex check, otherwise, they will be rejected in red text in the terminal.\n\n---\n\n## 📚 Core Command Cheat Sheet\n\nIn the Agent tool flow or internal sub-scripts, please strictly use the following API to access states:\n\n**1. Record temporary logs / session ledger (Volatile)**\n```bash\npython3 tools/memctl.py capture \"Tested API connectivity, successful.\"\n```\n\n**2. Create / Update task tracking (Living State)**\n```bash\npython3 tools/memctl.py work_upsert --task_id \"T-API-01\" --title \"Fix API\" --goal \"Connect interface\" --done_when \"Returns 200\"\n```\n\n**3. Accumulate knowledge & experience (Stable KB)**\n```bash\npython3 tools/memctl.py kb_append facts \"This API only accepts JSON format.\"\npython3 tools/memctl.py kb_append playbooks \"When encountering an error in this module, check if Redis is started first.\"\n```\n\n**4. Check script / Cron command compliance (Linter)**\n```bash\npython3 tools/memctl.py lint \"Command to execute or .md file path to check\"\n# Pass normally: Exit Code 0 (LINT PASS)\n# Illegal write: Exit Code 1 (LINT ERROR)\n```\n\n---\n*Built with ❤️ for OpenClaw / Berton Han*","tags":{"latest":"1.0.1"},"stats":{"comments":0,"downloads":900,"installsAllTime":0,"installsCurrent":0,"stars":1,"versions":4},"createdAt":1772041855657,"updatedAt":1779077391329},"latestVersion":{"version":"1.0.1","createdAt":1772092645736,"changelog":"Added pre-compaction override and bilingual support","license":null},"metadata":null,"owner":{"handle":"bertonhan","userId":"s17e3a3v8pxvbqng5amr4dydv9884rnt","displayName":"bertonhan","image":"https://avatars.githubusercontent.com/u/60309291?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779960507385}}