AGENT SKILL

会话状态延续记录

continuity_ledger

在长时间运行的会话中跨 /clear 保留会话状态。在运行 /clear 之前、上下文使用量超过约 70% 时,或用于需要中断后继续的多天实现和大型重构时使用。与 handoffs(跨会话)不同,ledger 用于在单个会话内保留状态。

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
continuity_ledger
description
Preserve session state across /clear in long-running sessions. Use before running /clear, when context usage passes ~70%, or for multi-day implementations and large refactors you pick up and put down. Unlike handoffs (cross-session), a ledger preserves state within one session.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

Continuity Ledger

Maintain a ledger file that survives /clear. Clear instead of compact: each compaction is lossy compression — after several, you work with degraded context. Clearing then reading the ledger gives fresh context with full signal.

When NOT to Use

  • Quick tasks (< 30 min)
  • Simple bug fixes
  • Single-file changes
  • Already using handoffs for cross-session transfer

Process

1. Determine Ledger File

Check if a ledger already exists:

ls thoughts/ledgers/CONTINUITY_CLAUDE-*.md 2>/dev/null
  • If exists: Update the existing ledger
  • If not: Create new file: thoughts/ledgers/CONTINUITY_CLAUDE-<session-name>.md
    • First ensure directory exists: mkdir -p thoughts/ledgers
    • Use kebab-case for session name (e.g., rbac-refactor, import-migration)

2. Create/Update Ledger

Use this template structure:

# Session: <name>
Updated: <ISO timestamp>

## Goal
<Success criteria - what does "done" look like?>

## Constraints
<Tech requirements, patterns to follow, things to avoid>

## Key Decisions
<Choices made with brief rationale>
- Decision 1: Chose X over Y because...
- Decision 2: ...

## State
- Done: <completed items>
- Now: <current focus - ONE thing only>
- Next: <queued items in priority order>

## Open Questions
- UNCONFIRMED: <things needing verification after clear>
- UNCONFIRMED: <assumptions that should be validated>

## Working Set
<Active files, branch, test commands>
- Branch: `feat/xyz`
- Key files: `v2/backend/apps/core/`, `v2/backend/apps/core/tests/`
- Test cmd: `docker exec aprender_dev-web-1 pytest apps/core/tests/ -v`
- Type check: `cd v2/backend && pyright apps/core config`

3. Update Guidelines

When to update the ledger:

  • Session start: Read and refresh
  • After major decisions
  • Before /clear
  • At natural breakpoints
  • When context usage >70%

What to update:

  • Move completed items from "Now" to "Done"
  • Update "Now" with current focus
  • Add new decisions as they're made
  • Mark items as UNCONFIRMED if uncertain

4. After Clear Recovery

When resuming after /clear:

  1. Read the ledger — cat thoughts/ledgers/CONTINUITY_CLAUDE-<name>.md
  2. Review UNCONFIRMED items
  3. Ask 1-3 targeted questions to validate assumptions
  4. Update ledger with clarifications
  5. Continue work with fresh context

Template Response

After creating/updating the ledger, respond:

Continuity ledger updated: thoughts/ledgers/CONTINUITY_CLAUDE-<name>.md

Current state:
- Done: <summary>
- Now: <current focus>
- Next: <upcoming>

Ready for /clear - read the ledger to resume.

Reference

How a ledger compares to CLAUDE.md / TodoWrite / handoffs, plus a full worked example (an rbac-capability-rename session) → reference/comparison-and-example.md.

Additional Notes

  • Keep it concise - Brevity matters for context
  • One "Now" item - Forces focus, prevents sprawl
  • UNCONFIRMED prefix - Signals what to verify after clear
  • Update frequently - Stale ledgers lose value quickly
  • Clear > compact - Fresh context beats degraded context

04 同仓库更多 Skills

matheusnorjosa
matheusnorjosa/aprender_sistema

技术文档写作规范

writing-standards

遵循 AS v2 技术写作规范(清晰、简洁、主动语态、Python/Django 惯例)。适用于撰写 README、文档字符串(PEP 257)、提交信息、PR 描述、错误信息或任何技术文档。

技术文档工程师技术文档编写
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

成果验证关卡

verification-gate

在宣称成功之前先进行验证。适用于准备表示某功能可用/已完成、实现功能后、修复缺陷后,或推送代码前——先运行验证命令并确认输出。

测试工程师成果验证与价值评估
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

测试驱动开发

test-driven-development

在 AS v2(pytest + Django/DRF)中先编写失败的测试,再进行实现。适用于实现功能或修复缺陷时,在编写任何生产代码之前使用。

测试工程师测试与质量保障
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

子智能体编排开发

subagent-development

在 AS v2 中编排子智能体——将任务拆解为相互独立的领域,并行处理并进行两阶段审查。适用于委派探索、实现或跨文件验证,以加快工作进度并节省主上下文。

AI 工程师编码任务委派
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

自动化安全扫描

security-scan

为 AS v2 提供自动化安全扫描。在提交前或审查变更中的漏洞时使用。执行依赖审计(pip-audit、npm audit)、密钥检测(grep 模式)和代码模式扫描(SQL 注入、XSS、eval、pickle、硬编码密钥)。与项目 hooks 系统集成。

安全工程师安全检测工程
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

交接文档恢复工作

resume-handoff

从保存的交接文档恢复工作,在继续之前先根据当前代码库验证其状态。适用于上下文清空后或在新会话中(通过路径、会话名称或 GitHub issue)从保存的交接文档恢复工作。

软件开发工程师会话上下文交接
★ 0