🤖 Agent Usage Guide (Read First)
If you are the current AI Agent and have just been asked to load, use, or analyze this skill:
- 1. 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! - 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. - 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.
TriCore Architecture
The underlying infrastructure of "storage and computation decoupling" built for true autonomous Agents.
Traditional 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.
TriCore abandons the paradigm of arbitrarily reading and writing text based on LLMs, and instead adopts a Code-First deterministic state machine:
- 1. Unified Engine: All memory additions, deletions, modifications, and queries must be routed through
tools/memctl.py. - Three-Layer Storage:
-
Brief (Layer 1):
MEMORY.md (System-level micro-profile, storing only pointers and laws)
-
Living (Layer 2):
memory/state/WORKING.md (Currently running task streams/lifecycle tracking)
-
Stable/Volatile (Layer 3):
memory/kb/*.md (Accumulated knowledge base) &
memory/daily/*.md (Temporary logs)
- 3. 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. - 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. - 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.
📦 Architectural Components
This skill package contains complete system components:
- 1.
tools/memctl.py: The core engine, containing subcommands like ensure, capture, work_upsert, kb_append, lint. install.sh: One-click installation script that automatically initializes directories and injects TriCore compliance policies into POLICY.md.cognitive-skills/: Three core cognitive skills refactored based on TriCore (as templates for your Agent to load):
-
planning-with-files.md: A PEP planning system that discards detached task lists.
-
react-agent.md: A ReAct loop based on persisting mental states to
WORKING.md.
-
self-evolution.md: An evolution system that completely detaches memory management and focuses on "Code-level CI/CD".
🧩 Core Dependencies & Runtime Requirements
As an underlying cognitive foundation, TriCore itself and its embedded three major cognitive skills have the following dependencies on the host environment:
1. Hard Dependencies
- - OpenClaw (v2026+): Must support native
memory_search and memory_get tools (this is the retrieval basis for completely deprecating reading large files). - Python 3.6+: Python 3 must be installed in the host environment (used to execute the
tools/memctl.py state engine). - System Tools:
bash, sed, grep (used for regular expression parsing by the Linter and Hooks).
2. Cognitive Skill Soft Dependencies
If 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.
- - 🌟
agent-browser (Highly Recommended):
-
Function: Enables the Agent to truly read GitHub source code, official API documentation, and the latest papers.
-
Installation: You need to separately install OpenClaw's
agent-browser skill, which provides WYSIWYG crawling and clicking capabilities based on a headless browser.
- - Search Tools (
web_search / web_fetch):
-
Function: Acts as a lightweight fallback for the browser, used to quickly extract Markdown snippets from public web pages.
- - Runtime Modification Permissions (
default_api:exec & default_api:write):
-
Function: The essence of the evolution skill is "modifying code"; if your Agent is running in a ReadOnly sandbox, evolution cannot occur.
🚀 Installation & Initialization (The 3-Step Setup)
In any completely new OpenClaw environment, executing the following command will deploy the TriCore architecture:
CODEBLOCK0
install.sh executes in the following order:
Step 1: Core Engine Deployment
- 1. Creates standard directories like
memory/state/, memory/kb/, memory/daily/. - Deploys the
tools/memctl.py engine to the current environment.
Step 2: Force Legacy MEMORY Migration (Agent Action Required)
In a low-resource architecture, a massive
MEMORY.md full of conversation history and diaries is extremely fatal.
The script will automatically detect the current
MEMORY.md:
- - If found to be too bloated (> 1500 bytes), it will be renamed and moved to
memory/archive/legacy-MEMORY-<date>.md. - Then, a compliant minimalist
MEMORY.md template will be rebuilt in the root directory. - 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!
Step 3: System Global Linter Blockade Deployment
The 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.
📚 Core Command Cheat Sheet
In the Agent tool flow or internal sub-scripts, please strictly use the following API to access states:
1. Record temporary logs / session ledger (Volatile)
CODEBLOCK1
2. Create / Update task tracking (Living State)
CODEBLOCK2
3. Accumulate knowledge & experience (Stable KB)
CODEBLOCK3
4. Check script / Cron command compliance (Linter)
python3 tools/memctl.py lint "Command to execute or .md file path to check"
# Pass normally: Exit Code 0 (LINT PASS)
# Illegal write: Exit Code 1 (LINT ERROR)
Built with ❤️ for OpenClaw / Berton Han
🤖 智能体使用指南(请先阅读)
如果你是当前AI智能体,且刚刚被要求加载、使用或分析此技能:
- 1. 这是你的基础操作系统法则。你的记忆与状态已完全被约束在TriCore架构之下。你严禁在根目录下随意创建独立的文本文件,如taskplan.md或findings.md!
- 你的记忆写入操作必须且只能通过命令行python3 tools/memctl.py (capture/workupsert/kbappend)进行代理。在读取历史记录时,你必须使用原生语义检索工具memorysearch来获取片段。
- 请将本手册作为你的基础操作指令。如果被指示配置Cron或编写系统自动化脚本,你必须在编写命令后调用memctl.py lint来测试方案的合法性。
TriCore架构
为真正自主智能体构建的存算分离底层基础设施。
传统智能体技能往往自带记忆包袱(如在项目根目录生成task_plan.md、reflection.md或零散的学习笔记),导致上下文孤岛和存储混乱。
TriCore摒弃了基于LLM随意读写文本的范式,转而采用代码优先的确定性状态机:
- 1. 统一引擎:所有记忆的增删改查必须通过tools/memctl.py路由。
- 三层存储:
-
简要层(第1层):MEMORY.md(系统级微档案,仅存储指针和法则)
-
活跃层(第2层):memory/state/WORKING.md(当前运行的任务流/生命周期追踪)
-
稳定/易失层(第3层):memory/kb/
.md(积累的知识库)和memory/daily/.md(临时日志)
- 3. 检索优先:禁止使用read工具直接灌入巨大文件,必须使用语义检索memory_search获取代码片段,大幅节省Token并保护低资源环境。
- 硬约束(Linting):内置原生memctl.py lint机制;任何破坏架构的Cron或技能变更都会被Linter拦截并报错。
- 系统兼容性(压缩钩子):安装时自动覆盖OpenClaw底层的压缩前内存刷新提示,防止在Token压缩期间因未授权的文件写入尝试导致HTTP 429请求爆发死循环。
📦 架构组件
本技能包包含完整的系统组件:
- 1. tools/memctl.py:核心引擎,包含ensure、capture、workupsert、kbappend、lint等子命令。
- install.sh:一键安装脚本,自动初始化目录并将TriCore合规策略注入POLICY.md。
- cognitive-skills/:基于TriCore重构的三大核心认知技能(作为智能体加载的模板):
- planning-with-files.md:摒弃独立任务列表的PEP规划系统。
- react-agent.md:基于将心智状态持久化到WORKING.md的ReAct循环。
- self-evolution.md:完全剥离记忆管理、聚焦代码级CI/CD的进化系统。
🧩 核心依赖与运行时要求
作为底层认知基础,TriCore本身及其嵌入的三大认知技能对宿主环境有以下依赖:
1. 硬依赖
- - OpenClaw(v2026+):必须支持原生memorysearch和memoryget工具(这是彻底弃用读取大文件的检索基础)。
- Python 3.6+:宿主环境必须安装Python 3(用于执行tools/memctl.py状态引擎)。
- 系统工具:bash、sed、grep(用于Linter和钩子的正则表达式解析)。
2. 认知技能软依赖
如果你启用cognitive-skills/self-evolution.md(自我代码进化技能),你的智能体必须具备向外探索的触角,否则只能在内部无限循环中进行幻觉式自我进化。
-
功能:使智能体能够真正读取GitHub源代码、官方API文档和最新论文。
-
安装:你需要单独安装OpenClaw的agent-browser技能,它提供基于无头浏览器的所见即所得爬取和点击能力。
- - 搜索工具(websearch / webfetch):
-
功能:作为浏览器的轻量级后备方案,用于快速提取公开网页的Markdown片段。
- - 运行时修改权限(defaultapi:exec和defaultapi:write):
-
功能:进化技能的本质是修改代码;如果你的智能体在只读沙箱中运行,进化将无法发生。
🚀 安装与初始化(三步设置)
在任何全新的OpenClaw环境中,执行以下命令即可部署TriCore架构:
bash
授予安装脚本权限并执行
bash ./install.sh
install.sh按以下顺序执行:
第一步:核心引擎部署
- 1. 创建memory/state/、memory/kb/、memory/daily/等标准目录。
- 将tools/memctl.py引擎部署到当前环境。
第二步:强制旧版MEMORY迁移(需要智能体操作)
在低资源架构中,充满对话历史和日记的庞大MEMORY.md极为致命。
脚本将自动检测当前的MEMORY.md:
- - 如果发现过于臃肿(超过1500字节),将重命名并移动到memory/archive/legacy-MEMORY-<日期>.md。
- 然后,在根目录重建一个合规的极简MEMORY.md模板。
- 智能体注意:此时你需要主动使用read读取旧版备份文件,并调用memctl.py重新分配这份旧版数据(事实存入kb/facts,规则存入kb/playbooks,日志存入daily);严禁将长文本原封不动粘贴回新的MEMORY.md!
第三步:系统全局Linter封锁部署
脚本将在系统的POLICY.md中注入一条[关键:TriCore合规]最高优先级防线。此后,智能体执行的所有涉及磁盘写入、状态更新和自动化任务的规划,都必须通过memctl.py lint的正则表达式检查,否则将在终端中以红色文本被拒绝。
📚 核心命令速查表
在智能体工具流或内部子脚本中,请严格使用以下API访问状态:
1. 记录临时日志/会话账本(易失层)
bash
python3 tools/memctl.py capture 已测试API连通性,成功。
2. 创建/更新任务追踪(活跃状态)
bash
python3 tools/memctl.py workupsert --taskid T-API-01 --title 修复API --goal 连接接口 --done_when 返回200
3. 积累知识与经验(稳定知识库)
bash
python3 tools/memctl.py kb_append facts 此API仅接受JSON格式。
python3 tools/memctl.py kb_append playbooks 遇到此模块错误时,先检查Redis是否启动。
4. 检查脚本/Cron命令合规性(Linter)
bash
python3 tools/memctl.py lint 要执行的命令或要检查的.md文件路径
正常通过:退出码0(LINT通过)
非法写入:退出码1(LINT错误)
为OpenClaw / Berton Han倾心打造 ❤️