ClawSkills logoClawSkills

Context Anchor

通过扫描记忆文件并显示上次中断的位置,从上下文压缩中恢复。在重新启动、压缩后或感到迷茫时使用。

介绍

# Context Anchor Skill

通过扫描内存文件并生成“你现在的位置”简报,帮助代理在压缩后恢复上下文。

## 为什么存在这个技能

上下文压缩会丢失记忆。但文件会保留下来。但在重新唤醒后,你需要: 1. 了解你之前正在处理什么 2. 查看已做出的决策 3. 找出需要收尾的未竟之事 4. 快速完成定位

该技能可以自动完成这一恢复过程。

---

## 快速开始

```bash # Full briefing (default) ./scripts/anchor.sh

# Just show current task ./scripts/anchor.sh --task

# Just show active context files ./scripts/anchor.sh --active

# Just show recent decisions ./scripts/anchor.sh --decisions

# Show open loops / questions ./scripts/anchor.sh --loops

# Scan specific number of days back ./scripts/anchor.sh --days 3 ```

---

## 扫描对象

| 来源 | 提取内容 | |--------|------------------| | `memory/current-task.md` | 当前任务状态、阻碍因素、下一步骤 | | `memory/YYYY-MM-DD.md` | 最近的每日日志(默认为过去 2 天) | | `context/active/*.md` | 进行中的任务文件 | | 每日日志 | 决策(包含“Decision:”、“Decided:”、“✅”的行) | | 每日日志 | 未竟之事(包含“?”、“TODO:”、“Blocker:”、“Need to”的行) |

---

## 输出格式

该脚本输出结构化的简报:

``` ═══════════════════════════════════════════════════════════ CONTEXT ANCHOR Where You Left Off ═══════════════════════════════════════════════════════════

📋 CURRENT TASK ─────────────────────────────────────────────────────────── [Contents of memory/current-task.md or "No current task set"]

📂 ACTIVE CONTEXT FILES ─────────────────────────────────────────────────────────── • context/active/project-name.md (updated 2h ago) └─ First line preview...

🎯 RECENT DECISIONS (last 2 days) ─────────────────────────────────────────────────────────── [2026-01-30] Decision: Use Cloudflare Pages for hosting [2026-01-30] ✅ Completed email capture setup

❓ OPEN LOOPS ─────────────────────────────────────────────────────────── [2026-01-30] Need to enable SFTP on NAS [2026-01-30] TODO: Create Product Hunt account

═══════════════════════════════════════════════════════════ ```

---

## 与 AGENTS.md 的集成

将其添加到你的“每次会话”流程中:

```markdown ## Every Session

Before doing anything else: 1. Run `./skills/context-anchor/scripts/anchor.sh` for orientation 2. Read `SOUL.md` — this is who you are 3. Read `USER.md` — this is who you're helping ... ```

或者当你对上下文感到迷茫时手动使用。

---

## 自定义

### 更改工作区根目录

```bash WORKSPACE=/path/to/workspace ./scripts/anchor.sh ```

### 更改扫描天数

```bash ./scripts/anchor.sh --days 5 # Scan 5 days back ```

---

## 无依赖

纯 bash 脚本。仅使用: - `find`、`grep`、`head`、`tail`、`date`、`stat` - 适用于 macOS 和 Linux - 无需外部工具

---

## 何时使用

- **会话开始**:快速了解当前进展 - **压缩之后**:恢复丢失的上下文 - **感到迷茫时**:“等等,我刚才在做什么?” - **工作交接**:向其他代理展示当前状态 - **每日回顾**:查看已做出的决策

更多产品