autonomoussessionworkflow

自主代理会话的五阶段可重复结构:上下文加载、分层工作选择、协调声明、执行和持久化学习。该结构可防止并发会话间的重复工作,并确保每次运行产生成果的持久化。与运行时无关,适用于 Claude Code、gptme、Codex 或任何具有持久工作区的代理。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "autonomoussessionworkflow":https://skillpi.com/zh/skills/deepskill-f57c750c982bcd36596bfd1ed845574ce92fb1ddd70b3e4a4fcc606f9dc02e9d。安装前核对上游来源和版本:https://skillhub.cn/skills/user_3c6cb52e/autonomous-session-workflow。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

自主代理会话的五阶段可重复结构:上下文加载、分层工作选择、协调声明、执行和持久化学习。该结构可防止并发会话间的重复工作,并确保每次运行产生成果的持久化。与运行时无关,适用于 Claude Code、gptme、Codex 或任何具有持久工作区的代理。

0 下载

介绍来源: third_party · user_3c6cb52e · 1.0.0 参考来源

SkillPi 解读

能完成的任务
自主代理会话的5阶段可重复结构:上下文加载、分层工作选择、协调声明、执行和持久化学习。防止并发会话之间重复工作,并确保每次运行都产生持久性成果。与运行时无关——适用于 Claude Code、gptme、Codex 或任何具有持久工作区的代理。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: "Autonomous Session Workflow"
slug: "autonomous-session-workflow"
version: "1.0.0"
displayName: "Autonomous Session Workflow"
summary: "自主代理会话的5阶段可重复结构:上下文加载、分层工作选择、协调声明、执行和持久化学习。防止并发会话之间重复工作,并确保每次运行都产生持久性成果。与运行时无关——适用于 Claude Code、gptme、Codex 或任何具有持久工作区的代理。"
license: "MIT"
description: "自主代理会话的5阶段可重复结构:上下文加载、分层工作选择、协调声明、执行和持久化学习。防止并发会话之间重复工作,并确保每次运行都产生持久性成果。与运行时无关——适用于 Claude Code、gptme、Codex 或任何具有持久工作区的代理。"
verification: "listed"
source: ""
category: "Templates & Workflows"
framework: "Claude Code"

自主会话工作流

一种用于自主代理会话的5阶段可重复结构,防止重复工作, 确保持久性学习捕捉,并使输出偏向于有意义的交付成果而非动作本身。 在 gptme 架构上已通过数千次自主会话的实战验证。这些阶段与运行时无关——只需将具体工具适配到你的技术栈,同时保持阶段结构不变。

使用时机

  • 每个自主代理会话开始时(无实时人类指导工作)
  • 当代理必须从待办事项或队列中选择自己的工作时

- 当会话无人值守且需要生成持久性成果时

不使用时机

  • 交互式会话,其中人类每轮提供下一个提示——只需响应即可
  • 固定目标的一次性工具调用(无需选择)

- 由父任务启动的子代理调用(父任务已选定工作)

5个阶段 第一阶段:上下文加载 加载代理的身份、会话状态和当前世界模型。

关键问题:“我留下了哪些未完成的工作,而我在离线期间发生了什么变化?”

如果一个松散的结尾可以在 <5 分钟内解决,则在此处理。否则记录下来并继续。

第二阶段:工作选择

# Read identity files — persona, goals, operating constraints
# (adapt to your stack: CLAUDE.md, AGENTS.md, system prompt, etc.)

# Read dynamic context — recent journal, task queue, git status, notifications
# (adapt: a context script, config-driven include, or prompt injection)

# Assess loose ends from prior sessions:
#   - Stale claims that should be completed or abandoned
#   - Pending replies on issues/PRs you promised to close
#   - In-progress branches or open worktrees

按顺序尝试各层级直到找到可执行的工作。这些层级防止代理在存在真实任务时编造忙碌工作,也防止所有任务都被阻塞导致饥饿。

反单调性保护机制:如果同一类别在过去 N 次会话中占主导地位,

即使看起来是最好的选择也要跳过。类别多样性是促使学习新失败模式的强制因素。

当一切都很干涸时:如果所有一级/二级任务都被外部阻塞且三级通道已饱和(达到每日限制),则写一篇简短的约束日志,记录你检查了什么并故意跳过了哪些内容。一个有理由的 NOOP 比伪造工作更好。 第三阶段:声明 执行前获取独占协调声明。这防止两个并发会话执行相同的工作、淹没同一个 PR 线程或写入同一文件。

Tier 1 — Active tasks: work already in progress; highest priority
Tier 2 — Backlog quick wins: dependency-ready items you can complete this session
Tier 3 — Self-improvement: when all tasks are externally blocked
  ├─ Idea backlog (advance the highest-scored idea)
  ├─ Self-review / audit (find and fix a real issue)
  ├─ Internal tooling improvement
  ├─ Documentation (stale docs only)
  ├─ Code quality (typecheck, tests, lint)
  └─ Lesson quality (repair harmful or outdated lessons)

先声明后通知规则:任何对他人可见的操作(发布评论、发送消息、开启 PR)必须首先通过声明。没有声明的社会行为会导致收敛和垃圾信息——“声明-然后发布”的模式可以防止泛滥。 完成时:coordination work-complete "<session-id>" "$claim_key" 转向/失败时:coordination work-abandon "<session-id>" "$claim_key"

第四阶段:执行 做实际工作。关键纪律是交付,而非完美。 50分钟预算:大多数自主会话应在 50 分钟内完成有意义的工作。如果任务较大,则提交一个增量切片并为剩余部分创建后续任务。

第五阶段:持久化

最被低估的阶段。除非持久化提交,否则在第 1–4 阶段中所做的所有工作都会在会话之间消失。 优先持久化规则:如果你发现了有用的内容,请在将其应用于当前工作之前写下教训。一旦修复完成,失败模式就感觉已解决,教训也会被忽略。日志记录了发生了什么;教训则捕捉到再次识别它的时机。 安装

# Generic coordination pattern — adapt the tool to your stack:
claim_key="task:<task-id>"          # for task-backed work
claim_key="github:<owner>/<repo>#<num>"  # for issue-backed work
claim_key="content:<slug>:<date>"   # for content/artifact creation

# Acquire claim (example using a coordination CLI):
coordination work-claim "<session-id>" "$claim_key" --ttl 60
# CLAIMED → proceed
# DENIED  → another session is already on it; pick the next candidate

Claude Code 将此技能目录复制到你的代理的技能文件夹中: 然后使用 /autonomous-session-workflow 调用以将 5 阶段检查清单加载到上下文中。

手动 / 任意运行时 将 SKILL.md 复制到你的代理的上下文路径并会在会话开始时加载它。这些阶段是纯 Markdown 格式——可包含整个文件或挑选与你技术栈相关的部分。

常见合理化行为

警示信号

- Commit early and often (small, well-described commits)
- Run tests before committing (catch issues before CI does)
- Use conventional commits: feat/fix/docs/refactor/chore
- Push to origin before the session ends
- If stuck for >10 minutes, move on — don't sink budget in a rabbit hole
- Don't add unrequested features or scope creep
  • 在声明前就开始执行(收敛风险)
  • 会话结束时没有日志也没有更新的任务状态
  • 承诺“稍后提交”——如果你在结束前没有推送,说明你尚未交付

- 连续三次在相同类别中运行而未强制打破多样性

  • “我会记住这个”——你会忘记;现在就写下教训 验证
# 1. Write the journal entry (session-specific file, append-only)
cat > journal/$(date +%Y-%m-%d)/session-<HASH>.md << 'EOF'
# Session <HASH>
**Date**: YYYY-MM-DD
**Outcome**: productive|blocked|noop — one sentence
**Category**: code|research|strategic|maintenance|...

## Why this work
[What led here]

## What I Did
[Concrete changes with commit/PR links]

## Verification
- [Tests passing? CI green?]

## Persisted Learning
- Task state: <task> → done/waiting
- New lessons: [if any]
- "No durable feedback this session" — if genuinely nothing to add

## Next
[Clear next action or blocking factor]
EOF

# 2. Update task state
task edit <task-id> --set state done   # or waiting, if blocked

# 3. If a recurring failure pattern was discovered, write a lesson/rule
#    (keyword-matched context file injected at the next session start)

# 4. Push all commits
git push origin master

一个运行良好的会话在关闭前满足以下所有条件:

  • [ ] 在行动前已声明(或说明为何无需声明)
  • [ ] 已提交并推送有意义的工作
  • [ ] 测试通过(或已记录已知失败及其原因)

- [ ] 日志条目已写入,且“持久化学习”部分已填写

- [ ] 任务状态已更新(active → done, active → waiting 等)

  • [ ] 声明已完成或放弃(未作为悬空租约保留)

适配你的技术栈

模式才是价值所在,而非具体工具。

相关

  • self-push(本目录中)——在交付任何输出前进行懒惰检查
  • pre-landing-review(本目录中)——合并重大变更前的准入控制

- multi-lens-review(本目录中)——跨多个视角的结构化 PR 审查

Rationalization Reality
"I'll skip the claim — I'm the only session running right now" You can't see other sessions launching. Concurrent spawning is the default on production runtimes. The claim is the gate, not the observation.
"I'll write the journal after I finish the next task" Sessions get interrupted. The journal gets skipped. Write it before pushing, not after "one more thing."
"This task is almost done — I'll skip Phase 5 and just commit" Learning only compounds if it's persisted. The session that "almost" closed the loop is the session whose insight disappears by next run.
"My selection is obvious — I don't need to work through the tiers" Selection that skips the tiers is the primary source of redundant work and duplicate PRs. The tiers exist because "obvious" is often not what actually needs doing.
"The lesson is too specific to be reusable" Specific lessons (exact error message, exact command, exact failure mode) are the most valuable — they trigger precisely when needed.
"A justified NOOP feels like failure" It isn't. A filler commit to dodge the NOOP label burns quota, feeds convergence churn, and hides the jam. A restraint journal IS the deliverable.

- five-element-spec(本目录中)——开始工作前定义范围

  • Starting execution before claiming (convergence risk)
  • Session ends with no journal and no updated task state
  • Committing "in a moment" — if you haven't pushed before ending, you haven't shipped
  • Three consecutive sessions in the same category without a forced diversity break
  • "I'll remember this" — you won't; write the lesson now

Verification

A well-run session satisfies all of these before closing:

  • [ ] Claimed before acting (or justified why no claim was needed)
  • [ ] Meaningful work committed and pushed
  • [ ] Tests passed (or a known failure documented with reason)
  • [ ] Journal entry written with Persisted Learning section filled in
  • [ ] Task state updated (active → done, active → waiting, etc.)
  • [ ] Claim completed or abandoned (not left as dangling lease)

Adapting to Your Stack

gptme concept Your equivalent
gptodo any task manager with state transitions
coordination work-claim a lock file, Redis SETNX, or GitHub comment gate
lessons/<category>/name.md any keyword-matched context file injected at session start
journal/<date>/session-<hash>.md any append-only session log
cascade-selector.py your work-selection heuristic or scheduler

The pattern is the value, not the specific tools.

Related

  • self-push (in this catalog) — lazy-check before shipping any output
  • pre-landing-review (in this catalog) — gate before merging significant changes
  • multi-lens-review (in this catalog) — structured PR review across multiple lenses
  • five-element-spec (in this catalog) — scope definition before starting work

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值90/100

亮点

  • 提供自主代理会话的5阶段可重复结构,具有高度实用价值
  • 适用于多种代理运行时(Claude Code、gptme、Codex等),通用性强
  • 防止并发会话重复工作,确保持久性学习捕捉,解决实际痛点
触发精准85/100

亮点

  • 触发词覆盖合理,包含多种使用场景描述
  • 边界清晰,明确区分使用时机和不使用时机
  • 提供了具体的调用方式和适配说明
结构规范90/100

亮点

  • 5个阶段划分清晰,每个阶段都有明确的目标和关键问题
  • 包含端到端示例和验证清单,结构完整
  • frontmatter信息完整,包含名称、版本、描述等必要信息
执行可靠80/100

亮点

  • 提供了具体的命令示例和适配模式
  • 覆盖了主要异常情况处理(如声明失败、任务阻塞等)
  • 包含验证清单确保会话完整性
证据可验 (前四项均值)86/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。