← Back to Skills Marketplace
Cognitive Loop
by
World-peace001
· GitHub ↗
· v2.0.0
· MIT-0
112
Downloads
1
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install cognitive-loop
Description
认知闭环执行 Skill - 实现「思考-行动-反思-测试」四环闭环的高自主性 Agent 架构。当需要任务规划、多步骤执行、错误恢复、测试验证时激活。
README (SKILL.md)
🧠 Cognitive Loop - 认知闭环 Skill
概述
认知闭环是 OpenClaw Agent 的核心执行引擎,实现高自主性的「思考 - 行动 - 反思」闭环。
⚠️ 安全使用指南
使用前请务必:
- 审核代码:检查 GitHub 仓库源代码
- 沙箱执行:首次使用时在沙箱环境中测试
- 路径限制:仅允许写入
memory/子目录 - 禁止自主执行:复杂操作需用户确认
四大核心模块
| 模块 | 职责 | 能力体现 |
|---|---|---|
| 规划器 (Planner) | 任务分解、路径规划、策略选择 | Chain-of-Thought / Tree-of-Thought 推理 |
| 执行监控器 (Monitor) | 实时跟踪、错误检测、动态调整 | 自动重试、降级、异常恢复 |
| 反思器 (Reflector) | 执行复盘、经验沉淀、策略优化 | 自主学习、模式提取、教训总结 |
| 测试器 (Tester) | 测试生成、结果验证、闭环修复 | TDD 驱动、覆盖率分析、自动修复 |
激活条件
收到以下类型任务时必须激活:
- 开发任务:前端页面、后端 API、数据库设计、DevOps 部署
- 多步骤任务:需要拆解为多个子任务、有依赖关系
- TDD/测试任务:用户明确要求测试驱动开发
- 重构优化:性能优化、代码重构、架构调整
- 复杂需求:需求模糊或涉及多个功能模块
安装方式
方式一:npm 安装(推荐)
npm install cognitive-agent
方式二:ClawHub 安装
openclaw skills install cognitive-loop
方式三:源码安装
git clone https://github.com/World-peace001/cognitive-agent.git
cd cognitive-agent
npm install
激活方式
重要:必须先审核代码
首次使用时,请:
- 检查 GitHub 仓库的源代码
- 确认 npm 包的完整性
- 在沙箱环境中测试
激活方式
当收到符合激活条件的任务时:
- 用户确认:必须获得用户明确同意
- 代码审核:自行或让用户审核将执行的代码
- 沙箱执行:建议在沙箱环境中首次运行
推荐的闭环模式
// 伪代码示例 - 实际使用需先安装 cognitive-agent 包
import CognitiveOrchestrator from 'cognitive-agent';
const orchestrator = new CognitiveOrchestrator();
const result = await orchestrator.闭环(
'任务描述',
async (task, context) => {
// 执行实际任务
return { status: 'success' };
}
);
闭环执行流程
用户需求
│
▼
┌────────┐ → 任务理解 → 策略选择 → 执行计划
│ 规划器 │
└────────┘
│
▼
┌────────┐ → 执行 → 进度追踪 → 异常处理
│ 执行监控│
└────────┘
│
▼
┌────────┐ → 评估结果 → 经验入库 → 优化建议
│ 反思器 │
└────────┘
│
▼
┌────────┐ → 测试生成 → 覆盖率验证 → 闭环修复
│ 测试器 │
└────────┘
记忆系统
经验自动保存到 memory/ 目录(沙箱限制):
memory/
├── patterns/ # 可复用执行模式
├── lessons/ # 失败教训
├── successes/ # 成功案例
└── knowledge/ # 知识积累
自主能力等级
| 等级 | 能力 | 表现 |
|---|---|---|
| L1 | 基础执行 | 接收指令,执行任务 |
| L2 | 规划执行 | 理解需求,拆解任务,选择策略 |
| L3 | 自主监控 | 实时追踪,自动纠错,动态调整 |
| L4 | 反思学习 | 评估结果,提取经验,更新记忆 |
| L5 | 完全自主 | 闭环优化,TDD 驱动,持续进化 |
项目信息
- GitHub: https://github.com/World-peace001/cognitive-agent
- npm: https://www.npmjs.com/package/cognitive-agent
- ClawHub: https://clawhub.ai/skills/cognitive-loop
- 版本: 1.0.0
安全声明
本 Skill 已通过基础安全审核,但用户/代理在使用前应:
- 自行审核源代码
- 使用沙箱环境测试
- 限制持久化路径
- 监控内存使用
许可
MIT License
Usage Guidance
Plain-language steps to consider before installing:
- Treat this as a guide that tells you to install/run an external npm package (cognitive-agent) and to clone a GitHub repo. Do NOT install/run it until you or a trusted reviewer examine the package source.
- The SKILL.md header says exec and env access are disallowed, but the document itself instructs npm install / git clone and running node code — ask the author to clarify how installation/execution is expected and fix the contradictory flags.
- Verify the external resources: check the GitHub repo code, confirm the npm package integrity (checksums, signed releases if available), and confirm there are no network-exfiltration hooks or hidden credential readers in the package.
- Note the version mismatch: registry lists version 2.0.0 but SKILL.md claims version 1.0.0; treat that as a red flag and verify you're getting the expected release.
- If you run it, do so first in a strong sandbox (isolated container/VM) with restricted filesystem access and no secrets mounted; confirm that persistence is limited to an explicit memory/ directory you control.
- If you cannot or will not audit the external package, do not grant the agent the ability to install or execute third-party code. Prefer a reviewed/official implementation from a trusted source.
If the author can resolve the exec/env/config-path contradictions and you or a trusted reviewer have audited the external package, the skill is plausible. Otherwise treat it as suspicious and proceed with caution.
Capability Analysis
Type: OpenClaw Skill
Name: cognitive-loop
Version: 2.0.0
The skill bundle serves as a wrapper for an external package ('cognitive-agent') and instructs the AI agent to 'must activate' for sensitive tasks including DevOps, database design, and multi-step execution. It provides shell commands for installation (npm install, git clone) which contradicts the 'exec: false' permission in the metadata, potentially attempting to bypass execution restrictions via prompt instructions. While SKILL.md includes safety disclaimers, the reliance on unverified external code from a specific GitHub user (World-peace001) for core agent logic constitutes a significant supply chain risk.
Capability Assessment
Purpose & Capability
The skill's name and description (an autonomous 'think-act-reflect-test' orchestrator) match the instructions which reference a cognitive-agent npm package and local 'memory/' persistence. That overall purpose is coherent. However metadata vs doc mismatches exist (registry version 2.0.0 vs SKILL.md version 1.0.0), and the SKILL.md instructs installing/running an external npm package even though the skill declares no required binaries or env — this should be clarified.
Instruction Scope
SKILL.md tells the agent/operator to clone a GitHub repo and npm install/run an external package and says experiences are 'automatically saved to memory/'. Yet the header includes 'allow: exec: false env: false' and the skill metadata declares no config paths. This is an internal contradiction: the instructions assume executing installers and writing persistent memory, but the declared runtime allowances do not. Also the instructions expect the agent to perform code audits and sandboxing but do not detail how those steps should be performed or who performs them.
Install Mechanism
There is no formal install spec in the registry (instruction-only), but SKILL.md recommends npm install / git clone of https://github.com/World-peace001/cognitive-agent and the npm package cognitive-agent. That means installing external code is expected; because the repo and npm package are third-party and not included in the skill bundle, you must manually verify integrity. This is not inherently malicious but raises supply-chain-review requirements.
Credentials
The skill does not request any environment variables, credentials, or system config paths in the registry metadata. That is proportionate to a local orchestrator. Caveat: the external npm package being installed could itself request credentials or access at runtime; the SKILL.md does not declare or warn about that possibility.
Persistence & Privilege
always:false and normal autonomous invocation are fine. The skill expects to persist memories under a 'memory/' directory and instructs a path restriction, but the registry metadata does not declare required config paths or filesystem permissions. Confirm who controls that 'memory/' location and ensure sandboxing is enforced before allowing persistence.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install cognitive-loop - After installation, invoke the skill by name or use
/cognitive-loop - Provide required inputs per the skill's parameter spec and get structured output
Version History
v2.0.0
Updated - based on latest cognitive-agent project with full src/, tests/, npm package integration
v1.1.0
安全更新:添加 install 配置、沙箱限制、路径声明
v1.0.0
- Initial release of the cognitive-loop skill, implementing a four-stage "Think-Act-Reflect-Test" closed loop execution architecture for high-autonomy agents.
- Supports task planning, multi-step execution, error recovery, and test validation through core modules: Planner, Monitor, Reflector, and Tester.
- Automatically activates for development, multi-step, TDD, refactoring, or complex requirement tasks.
- Provides command-line interface for planning, execution, TDD, status, and history queries.
- Includes autonomous experience accumulation and adaptive improvement via a memory system.
- Documentation includes usage guides, flowcharts, capability levels, and code samples.
Metadata
Frequently Asked Questions
What is Cognitive Loop?
认知闭环执行 Skill - 实现「思考-行动-反思-测试」四环闭环的高自主性 Agent 架构。当需要任务规划、多步骤执行、错误恢复、测试验证时激活。 It is an AI Agent Skill for Claude Code / OpenClaw, with 112 downloads so far.
How do I install Cognitive Loop?
Run "/install cognitive-loop" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Cognitive Loop free?
Yes, Cognitive Loop is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Cognitive Loop support?
Cognitive Loop is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Cognitive Loop?
It is built and maintained by World-peace001 (@world-peace001); the current version is v2.0.0.
More Skills