Audit Session logo

Audit Session

Organization
devcodex-labs
audit-session

审计工作流的跨会话状态机 — 在 <audit-root>/.audit-state/<session-id>.json 持久化轮次/发现项/收敛状态,支持 Token 中断后精准恢复

Overview

Publisherdevcodex-labs
Repositorydevcodex
Skill nameaudit-session
Stars
433
Forks
44
Bundled files
1
LicenseAGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by devcodex-labs on GitHub. Read the source before you install it.

Installation

Install the Audit Session AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/devcodex-labs/devcodex/tree/main/content/skills/audit-session
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/devcodex-labs/devcodex.git /tmp/devcodex
mkdir -p .claude/skills
cp -r /tmp/devcodex/content/skills/audit-session .claude/skills/audit-session
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Audit Session in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Audit Session on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Audit Session is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Audit Session Skill

适用范围

  • 触发:意图为 audit(包括默认 3 轮与合格 narrow-2 的 2 轮场景)
  • 不适用:analyze(仅 ≥3 轮收敛但无 audit finding 交接状态机)、chat(无审计语义)

状态文件路径

text
<audit-root>/.audit-state/<session-id>.json

<audit-root> 取值:

  • 旧布局:<项目根>/.devcodex

  • 集中布局单项目:<工作区根>/.devcodex/<project>

  • 集中布局全工作区:<工作区根>/.devcodex/workspace

  • <session-id> 取首次启动审计的时间戳:YYYYMMDD-HHmmss

  • <audit-root>/.audit-state/ 目录由本 Skill 首次写入时创建(不随 init 分发)

  • .gitignore 须覆盖 <audit-root>/.audit-state/ 对应路径(如 .devcodex/.audit-state/、.devcodex/*/.audit-state/,同记忆策略)

状态机

text
active ──┬─> paused (Token 防护触发 / 用户中断)
         ├─> resumed (跨会话 resume 重新进入)
         ├─> converged (CRS + PCV 通过 + 连续 R 轮有效零发现)
         └─> closed (用户确认审计闭环)

paused ──> resumed ──> active
converged ──> closed
状态进入条件退出条件
active首次 audit 意图识别成功任一退出条件触发
pausedC08 Token 防护(>15 轮)或 用户中断resume 意图 + 当前 session 命中
resumedresume 意图 + 读取本文件立即转 active 继续审计
convergedzeroFindingStreak ≥ R 且 crsPassed 且 pcvPassed用户确认 → closed
closed用户确认审计完成或放弃终态(不再写入)

收敛轮数 R 统一由 review-execution-contract.cjs 的 requiredAuditZeroFindingRounds(state) 消费:默认 3;仅满足 audit-common 的窄范围条件,且状态保存 convergenceMode="narrow-2" 和完整、候选绑定、摘要有效的 reviewExecutionPlan(公开 Owner 的 ReviewExecutionPlanV1 原件,exit.auditConvergence.mode="narrow-2")时为 2。缺计划、被修改的计划或 full/security/release 等不合格输入仍要求 3;不得只写标签或手改轮数降档。CRS、PCV、覆盖增量、维度增量与未解决 finding 门禁保持适用。

状态文件 schema

json
{
  "schemaVersion": "AuditSessionStateV2",
  "sessionId": "20260520-143055",
  "startedAt": "2026-05-20T14:30:55+08:00",
  "lastUpdatedAt": "2026-05-20T16:12:33+08:00",
  "target": {
    "type": "spec | tech-design | requirements | project | report | document",
    "scope": "<被审查文件 glob 或目录>"
  },
  "dimensions": ["D1", "D2", "..."],
  "round": 3,
  "state": "active | paused | resumed | converged | closed",
  "findings": [
    {
      "id": "F-001",
      "round": 1,
      "dim": "D5",
      "file": "instructions/12-audit.instructions.md",
      "severity": "🔴 | 🟡 | 💡",
      "summary": "<一句话>",
      "status": "open | pending | in-progress | fixed | wontfix | accepted | recorded | transferred | superseded",
      "category": "spec-defect | release-pending | v{X.Y.Z}-candidate",
      "fixPlan": "<修复方案概述>",
      "fixCommit": "<git commit hash, 修复后写入>",
      "linkedPF": "PF-NNN | null"
    }
  ],
  "regressionProbes": [
    {
      "findingId": "F-007",
      "scanCmd": "grep -c 'PC5' CLAUDE.md",
      "expectedMatches": 3,
      "lastVerifiedRound": 4,
      "lastVerifiedAt": "2026-05-21T03:30:00+08:00"
    }
  ],
  "r2Probes": [{"name": "<probe>", "status": "✅|⚠️|❌"}],
  "r3Probes": [{"name": "<probe>", "status": "✅|⚠️|❌"}],
  "r4Probes": [{"name": "<probe>", "status": "✅|⚠️|❌"}],
  "convergenceMode": "default-3",
  "zeroFindingStreak": 0,
  "crsPassed": false,
  "pcvPassed": false,
  "remoteReleased": {
    "gitPush": false,
    "npmPublish": false,
    "recordedAt": "ISO8601",
    "source": "user-confirmed-manual | ci-automation"
  },
  "lastCheckpoint": {
    "round": 3,
    "writtenAt": "2026-05-20T16:12:33+08:00",
    "reason": "round-end | token-protect | user-interrupt | switching-to-release-vX.Y.Z | release-pending-vX.Y.Z"
  },
  "linkedMemory": "tasks/20260520.md",
  "linkedReport": "<active-root>/<task-kind>/<task>/reports/<agent>/20260520/01--<name>.md",
  "linkedRelease": "<active-root>/requirements/<task>/reports/<agent>/YYYYMMDD/01--vX.Y.Z-release.md"
}

.audit-state 兼容读取边界

.audit-state 是多类运行态证据的共享目录名,不代表目录内每个 JSON 都属于当前审计会话。读取者必须先分类,再决定校验方式:

分类识别处理
current sessionexact AuditSessionStateV1 / AuditSessionStateV2按本 Skill 的状态、finding 与 regression probe 合同严格校验
legacy auditAuditStateV1 或可识别的历史无 schema 审计形状只读导航与取证,不要求满足当前枚举或新探针,不改写历史字节
non-auditSkillRoute、batch plan、validation 等其他 schema跳过审计会话校验,由各自 owner 负责
unsupported current未支持的 AuditSessionStateV*明确报告不支持,禁止猜测或降成 legacy
invalidJSON 损坏或顶层不是 object报告结构错误,不静默忽略

兼容分类只解决 reader 误判,不授予旧状态新的写权限,也不得伪造 superseded、重算旧 finding 或迁移历史文件。

v1.9.4+ schema 字段说明

字段引入用途
findings[].categoryv1.9.4分类标识:spec-defect(规范缺陷)/ release-pending(仅发版动作未启动导致)/ v{X.Y.Z}-candidate(推迟到下版本同源合并)
findings[].fixPlanv1.9.4修复方案概述,留作 release/dev 工作流参考
findings[].fixCommitv1.9.4独立 fix/self-fix 工作流产生的修复 commit hash;audit 只读取并验证,不自行提交
regressionProbes[]v1.9.5+已修复 finding 的回归扫描定义;audit-common §收敛门禁第 7 步触发;任一回归 → status 切回 open,streak 归零
r{N}Probes[]v1.9.4第 N 轮的探针清单与状态,便于跨会话 resume 时审计深度可追溯
remoteReleasedv1.9.4远端发版动作状态(git push + npm publish),消除 release-pending findings 的依据
lastCheckpoint.reasonv1.9.4扩充值:switching-to-release-vX.Y.Z(切 release 流程缓冲)/ release-pending-vX.Y.Z(等下版本合并)
linkedReleasev1.9.4关联 release 报告路径,建立 audit → release 双向链

findings[].status 枚举

状态含义是否未解决
open当前审计仍需处理是
pending已确认但等待后续批次处理是
in-progress正在修复或验证中是
fixed已修复并通过回归验证否
wontfix已确认不修复,需保留理由否
accepted已接受为项目例外或可接受风险,需保留理由否
recorded已记录到外部台账、问题池或报告,当前审计不再直接处理否
transferred已转入其他报告、需求或问题池继续跟进否
superseded已被后续报告或新版结论取代否

终态 converged / closed 不得保留 open、pending、in-progress findings;允许 fixed、wontfix、accepted、recorded、transferred、superseded 作为已处置状态。

写入时机

AuditMutationBoundaryGate:audit session 只记录 finding/交接/外部修复证据;sourceMutationAuthorized 在 audit 中恒为 false,用户修复授权由独立 fix/self-fix 的 CP/ExecutionContract 持有。

时机动作字段更新
首轮启动创建文件,state=activesessionId / startedAt / target / dimensions
每轮结束追加 findings + 更新 roundround / findings / zeroFindingStreak
CRS 完成标记通过状态crsPassed
PCV 完成标记通过状态pcvPassed
Token 防护(C08 >15轮)state=pausedstate / lastCheckpoint.reason=token-protect
收敛state=convergedstate
用户确认state=closedstate

与其他 Skill / Instruction 的协同

关联点说明
instructions/12-audit.instructions.md审计工作流入口须读取/创建本文件;收敛门禁须校验 crsPassed && pcvPassed && zeroFindingStreak>=R
instructions/15-memory.instructions.mdtasks/YYYYMMDD.md 段落须追加 🔗 审计会话:<session-id> 字段,建立双向链
intent/SKILL.mdresume 意图识别后须在三层记忆读取之前优先扫描 <audit-root>/.audit-state/*.json 查找未 closed 的会话
skills/audit-execution-guide/SKILL.mdfinding 先记录/交接;用户显式授权的独立 fix/self-fix 完成后,audit 读取新证据并重启新轮,旧轮不得在 audit 内伪造 fixed

跨会话 resume 流程

  1. 用户说"继续审计" / "继续上次的审查"
  2. 读取 <audit-root>/.audit-state/ 下有界 .json 清单,先按上述兼容规则分类
  3. 只在 current session 与可导航的 legacy audit 中按 lastUpdatedAt 倒序,找出 state ∈ {paused, active, resumed} 的最新一份;其他 schema 不参与排序
  4. 输出:"发现未完成审计会话 <sessionId>:目标 <target.scope>,已完成 R{round},发现 {open} 项 open。是否继续?"
  5. 用户确认 → state=resumed → 立即 → active,从 round+1 开始
  6. 用户拒绝 → 询问是否 closed 该会话

⛔ 禁止

  • ⛔ 状态文件不得提交到 git(同 .devcodex/.memory/)
  • ⛔ 同一 sessionId 不得并行写入;这是 C07 ConcurrencyPolicy 中不可变 audit-session 单写者锁,不受项目 concurrency 配置放开
  • ⛔ converged 状态不得自动转 closed —— 须用户明确确认(避免静默关闭)
  • ⛔ audit 不得因 finding 严重度或对象是 plugin 文件而自动获得 fix/self-fix、git add、commit 或 source mutation 权限

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Audit Session AI skill do?

审计工作流的跨会话状态机 — 在 <audit-root>/.audit-state/<session-id>.json 持久化轮次/发现项/收敛状态,支持 Token 中断后精准恢复

Why use Audit Session on TypingMind?

Because you install it once and use it with any model. Audit Session is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Audit Session in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/devcodex-labs/devcodex/tree/main/content/skills/audit-session. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Audit Session?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Audit Session?

As many as you like. As long as a model supports skills, you can use Audit Session with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Audit Session AI skill free?

Yes. It is published on GitHub by devcodex-labs under the AGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇