autonomoussessionworkflow

A five-stage repeatable structure for autonomous agent sessions: context loading, hierarchical task selection, coordination declarations, execution, and persistent learning. The structure prevents duplicated work between concurrent sessions and ensures each run produces persistent results. Runtime-agnostic — applicable to Claude Code, gptme, Codex, or any agent with a persistent workspace.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "autonomoussessionworkflow" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-f57c750c982bcd36596bfd1ed845574ce92fb1ddd70b3e4a4fcc606f9dc02e9d. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/autonomous-session-workflow before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A five-stage repeatable structure for autonomous agent sessions: context loading, hierarchical task selection, coordination declarations, execution, and persistent learning. The structure prevents duplicated work between concurrent sessions and ensures each run produces persistent results. Runtime-agnostic — applicable to Claude Code, gptme, Codex, or any agent with a persistent workspace.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
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

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value90/100

Highlights

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

Highlights

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

Highlights

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

Highlights

  • 提供了具体的命令示例和适配模式
  • 覆盖了主要异常情况处理(如声明失败、任务阻塞等)
  • 包含验证清单确保会话完整性
Evidence Verifiability (mean of the first four)86/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

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

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.