@fitlab-ai/agent-infra 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/bin/internal-cli.js +0 -5
  2. package/dist/lib/decide.js +4 -41
  3. package/dist/lib/git/branch-worktree.js +45 -0
  4. package/dist/lib/internal/cli-route-inventory.js +0 -3
  5. package/dist/lib/internal/task-activity.js +7 -40
  6. package/dist/lib/internal/task-event.js +4 -37
  7. package/dist/lib/internal/task-finalization.js +9 -2
  8. package/dist/lib/internal/task-ledger.js +5 -43
  9. package/dist/lib/internal/task-lifecycle.js +1 -1
  10. package/dist/lib/internal/task-operation-registry.js +1 -4
  11. package/dist/lib/internal/task-review.js +5 -37
  12. package/dist/lib/internal/task-verify.js +3 -47
  13. package/dist/lib/internal/task-warning.js +4 -40
  14. package/dist/lib/platform/pr-summary.js +4 -23
  15. package/dist/lib/platform/verification-sync.js +12 -49
  16. package/dist/lib/sandbox/control/client.js +4 -1
  17. package/dist/lib/sandbox/control/executor.js +12 -4
  18. package/dist/lib/sandbox/control/protocol.js +2 -1
  19. package/dist/lib/sandbox/removal.js +15 -8
  20. package/dist/lib/task/activity-intent.js +1 -2
  21. package/dist/lib/task/artifact-operations.js +36 -2
  22. package/dist/lib/task/artifact-schema.js +7 -7
  23. package/dist/lib/task/control-authority.js +9 -166
  24. package/dist/lib/task/decision-intents.js +2 -4
  25. package/dist/lib/task/events.js +7 -28
  26. package/dist/lib/task/finalization-handoff.js +92 -0
  27. package/dist/lib/task/finalization.js +123 -12
  28. package/dist/lib/task/intermediate-cleanup.js +9 -148
  29. package/dist/lib/task/ledger-intents.js +3 -6
  30. package/dist/lib/task/lifecycle.js +50 -11
  31. package/dist/lib/task/local-artifact-finalization.js +13 -28
  32. package/dist/lib/task/review-command.js +1 -2
  33. package/dist/lib/task/review-finalization.js +1 -2
  34. package/dist/lib/task/snapshot.js +6 -6
  35. package/dist/lib/task/verification-engine.js +16 -11
  36. package/dist/lib/task/verification.js +1 -13
  37. package/dist/lib/task/workflow-warning-intents.js +2 -4
  38. package/dist/lib/task/write.js +1 -2
  39. package/dist/lifecycle-build-manifest.json +3 -3
  40. package/lib/decide.ts +5 -35
  41. package/lib/git/branch-worktree.ts +41 -0
  42. package/lib/internal/cli-route-inventory.ts +0 -2
  43. package/lib/internal/task-activity.ts +6 -34
  44. package/lib/internal/task-event.ts +4 -37
  45. package/lib/internal/task-finalization.ts +9 -2
  46. package/lib/internal/task-ledger.ts +5 -38
  47. package/lib/internal/task-lifecycle.ts +2 -2
  48. package/lib/internal/task-operation-registry.ts +1 -4
  49. package/lib/internal/task-review.ts +5 -31
  50. package/lib/internal/task-verify.ts +3 -39
  51. package/lib/internal/task-warning.ts +3 -32
  52. package/lib/platform/pr-summary.ts +4 -25
  53. package/lib/platform/verification-sync.ts +13 -53
  54. package/lib/sandbox/control/client.ts +5 -1
  55. package/lib/sandbox/control/executor.ts +13 -4
  56. package/lib/sandbox/control/protocol.ts +3 -2
  57. package/lib/sandbox/removal.ts +23 -7
  58. package/lib/task/activity-intent.ts +1 -2
  59. package/lib/task/artifact-operations.ts +58 -2
  60. package/lib/task/artifact-schema.ts +9 -7
  61. package/lib/task/control-authority.ts +14 -188
  62. package/lib/task/decision-intents.ts +2 -4
  63. package/lib/task/events.ts +8 -27
  64. package/lib/task/finalization-handoff.ts +104 -0
  65. package/lib/task/finalization.ts +120 -12
  66. package/lib/task/intermediate-cleanup.ts +9 -125
  67. package/lib/task/ledger-intents.ts +3 -6
  68. package/lib/task/lifecycle.ts +45 -13
  69. package/lib/task/local-artifact-finalization.ts +16 -35
  70. package/lib/task/review-command.ts +2 -5
  71. package/lib/task/review-finalization.ts +1 -4
  72. package/lib/task/snapshot.ts +6 -6
  73. package/lib/task/verification-engine.ts +20 -10
  74. package/lib/task/verification.ts +1 -15
  75. package/lib/task/workflow-warning-intents.ts +2 -4
  76. package/lib/task/write.ts +1 -4
  77. package/package.json +1 -1
  78. package/templates/.agents/skills/analyze-task/SKILL.en.md +11 -2
  79. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -2
  80. package/templates/.agents/skills/code-task/reference/report-template.en.md +6 -6
  81. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +6 -6
  82. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +2 -2
  83. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +2 -2
  84. package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +1 -3
  85. package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +1 -3
  86. package/templates/.agents/skills/complete-task/config/verify.en.json +2 -2
  87. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +2 -2
  88. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +3 -3
  89. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +3 -3
  90. package/templates/.agents/skills/review-code/reference/report-template.en.md +3 -3
  91. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +3 -3
  92. package/templates/.agents/skills/review-plan/reference/report-template.en.md +3 -3
  93. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +3 -3
  94. package/templates/.agents/skills/review-pr/config/verify.en.json +3 -1
  95. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +3 -1
  96. package/templates/.agents/skills/review-pr/reference/report-template.en.md +3 -3
  97. package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +3 -3
  98. package/templates/.agents/skills/run-manual-validation/config/verify.en.json +2 -2
  99. package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +2 -2
  100. package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
  101. package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
  102. package/dist/lib/internal/task-override.js +0 -138
  103. package/dist/lib/task/artifact-recovery.js +0 -476
  104. package/dist/lib/task/artifact-repair-intent.js +0 -181
  105. package/dist/lib/task/guard-override.js +0 -31
  106. package/dist/lib/task/human-override.js +0 -1259
  107. package/lib/internal/task-override.ts +0 -144
  108. package/lib/task/artifact-recovery.ts +0 -572
  109. package/lib/task/artifact-repair-intent.ts +0 -227
  110. package/lib/task/guard-override.ts +0 -50
  111. package/lib/task/human-override.ts +0 -1522
@@ -12,8 +12,6 @@ import { resolveTaskRef } from './resolve-ref.ts';
12
12
  import { validateLifecycleExecution } from './lifecycle-execution.ts';
13
13
  import { TaskExecutionLockError, withTaskExecutionLock } from './task-execution-lock.ts';
14
14
  import type { ResolveTaskRefErrorCode } from './resolve-ref.ts';
15
- import { allowsManualOverride } from './guard-override.ts';
16
- import type { ManualOverrideCapability } from './guard-override.ts';
17
15
  import { getArtifactSchema } from './artifact-schema.ts';
18
16
  import { canonicalSemanticDigest, inspectArtifactContract, sha256Content } from './artifact-operations.ts';
19
17
 
@@ -70,7 +68,6 @@ type ReviewFileSystem = {
70
68
  type ReviewFinalizationOptions = {
71
69
  repoRoot?: string;
72
70
  fileSystem?: Partial<ReviewFileSystem>;
73
- manualOverride?: ManualOverrideCapability;
74
71
  lockAlreadyHeld?: boolean;
75
72
  };
76
73
 
@@ -224,7 +221,7 @@ function prepareReviewSummaryCandidate(
224
221
  const resolved = resolveTaskRef(request.taskRef, { repoRoot: options.repoRoot });
225
222
  taskId = resolved.taskId ?? null;
226
223
  if (!resolved.ok) return reject(resolved.code, resolved.message);
227
- if (resolved.state !== 'active' && !allowsManualOverride(options.manualOverride, 'review-finalization', 'TASK_STATE_MISMATCH')) {
224
+ if (resolved.state !== 'active') {
228
225
  return reject('TASK_STATE_MISMATCH', `task ${taskId} is ${resolved.state}, expected active`);
229
226
  }
230
227
  const parsed = parseArtifactName(request.artifact);
@@ -97,22 +97,22 @@ function collectTaskSnapshot(taskRef: string, options: SnapshotOptions = {}): Ta
97
97
  const observations: SnapshotObservation[] = [];
98
98
  try {
99
99
  const output = stripOneTrailingNewline((options.gitStatus ?? defaultGitStatus)(resolved.repoRoot));
100
- observations.push({ name: 'git', status: 'ready', command: '$ git status -s', output, error: null });
100
+ observations.push({ name: 'git', status: 'ready', command: 'git status --short --untracked-files=all', output, error: null });
101
101
  } catch (error) {
102
- return failedSnapshot(resolved, taskRef, observations, 'git', '$ git status -s', 'SNAPSHOT_GIT_FAILED', error);
102
+ return failedSnapshot(resolved, taskRef, observations, 'git', 'git status --short --untracked-files=all', 'SNAPSHOT_GIT_FAILED', error);
103
103
  }
104
104
  try {
105
105
  const entries = (options.readDirectory ?? ((dir) => fs.readdirSync(dir, { withFileTypes: true })))(resolved.taskDir);
106
106
  const output = renderDirectory(entries, resolved.taskDir, options.lstat ?? fs.lstatSync);
107
- observations.push({ name: 'task-directory', status: 'ready', command: `$ ls -la ${taskDirPath}/`, output, error: null });
107
+ observations.push({ name: 'task-directory', status: 'ready', command: `fs.readdirSync ${taskDirPath}/`, output, error: null });
108
108
  } catch (error) {
109
- return failedSnapshot(resolved, taskRef, observations, 'task-directory', `$ ls -la ${taskDirPath}/`, 'SNAPSHOT_DIRECTORY_READ_FAILED', error);
109
+ return failedSnapshot(resolved, taskRef, observations, 'task-directory', `fs.readdirSync ${taskDirPath}/`, 'SNAPSHOT_DIRECTORY_READ_FAILED', error);
110
110
  }
111
111
  try {
112
112
  const content = (options.readTask ?? ((file) => fs.readFileSync(file, 'utf8')))(resolved.taskMdPath);
113
- observations.push({ name: 'task-tail', status: 'ready', command: `$ tail ${taskPath}`, output: renderTail(content), error: null });
113
+ observations.push({ name: 'task-tail', status: 'ready', command: `fs.readFileSync ${taskPath} (last 10 lines)`, output: renderTail(content), error: null });
114
114
  } catch (error) {
115
- return failedSnapshot(resolved, taskRef, observations, 'task-tail', `$ tail ${taskPath}`, 'SNAPSHOT_TASK_READ_FAILED', error);
115
+ return failedSnapshot(resolved, taskRef, observations, 'task-tail', `fs.readFileSync ${taskPath} (last 10 lines)`, 'SNAPSHOT_TASK_READ_FAILED', error);
116
116
  }
117
117
  return {
118
118
  status: 'ready', changed: false, requestRef: taskRef, taskId: resolved.taskId,
@@ -23,6 +23,7 @@ import { inspectPlatformPullRequest } from "../platform/pull-requests.ts";
23
23
  import { resolveMaterializedReviewedHeadRelation } from "../platform/change-request-git-evidence.ts";
24
24
  import { resolveReviewedHeadRelation } from "../platform/merged-pr-equivalence.ts";
25
25
  import { resolveLocalReviewedCommitRelation } from "../git/reviewed-commit-equivalence.ts";
26
+ import { resolveBranchWorktree } from "../git/branch-worktree.ts";
26
27
  import { parseTypedTaskFrontmatter } from "./frontmatter.ts";
27
28
  import { LEDGER_TERMINAL, LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, parseLedgerDocument, summarizeLedgerStage, validateLedgerRows } from "./ledger.ts";
28
29
  import type { LedgerRow } from "./ledger.ts";
@@ -570,6 +571,23 @@ function checkArtifact({ taskDir, config, artifactFile, skillName }: any): any {
570
571
  }
571
572
  }
572
573
 
574
+ const stateCheckPatterns = config.state_check_patterns || [];
575
+ if (stateCheckPatterns.length > 0) {
576
+ const scanned = scanVisibleMarkdown(content);
577
+ const stateCheckHeading = scanned.headings.find((heading) => (
578
+ heading.level === 2 && (heading.text === "状态核对" || heading.text === "State Check")
579
+ ));
580
+ const nextHeading = stateCheckHeading && scanned.headings.find((heading) => (
581
+ heading.start > stateCheckHeading.start && heading.level <= 2
582
+ ));
583
+ const stateCheckBody = stateCheckHeading ? content.slice(stateCheckHeading.end, nextHeading?.start ?? content.length) : "";
584
+ for (const pattern of stateCheckPatterns) {
585
+ if (!new RegExp(pattern, "m").test(stateCheckBody)) {
586
+ return failResult("artifact", `${path.basename(artifactPath)} state-check section is missing required command: ${pattern}`);
587
+ }
588
+ }
589
+ }
590
+
573
591
  return passResult(
574
592
  "artifact",
575
593
  `${path.basename(artifactPath)} passed (${requiredSections.length} sections)`
@@ -1251,16 +1269,8 @@ function checkReviewFact({ taskDir, artifactFile, repositoryRoot }: any): any {
1251
1269
 
1252
1270
  function reviewWorktreeForTask(repositoryRoot: string, branch: string): string | null {
1253
1271
  if (!branch) return null;
1254
- const expectedRef = `refs/heads/${branch}`;
1255
- const records = execFileSync("git", ["-C", repositoryRoot, "worktree", "list", "--porcelain"], {
1256
- encoding: "utf8",
1257
- stdio: ["pipe", "pipe", "pipe"]
1258
- }).trim().split(/\r?\n\r?\n/);
1259
- for (const record of records) {
1260
- const worktree = /^worktree (.+)$/m.exec(record)?.[1];
1261
- const branchRef = /^branch (.+)$/m.exec(record)?.[1];
1262
- if (worktree && branchRef === expectedRef) return worktree;
1263
- }
1272
+ const worktree = resolveBranchWorktree(repositoryRoot, branch);
1273
+ if (worktree) return worktree;
1264
1274
  throw new Error(`Task branch '${branch}' is not checked out in a registered worktree`);
1265
1275
  }
1266
1276
 
@@ -7,8 +7,6 @@ import { parseArtifactName } from './artifact-name.ts';
7
7
  import type { ArtifactFamily } from './artifact-lifecycle.ts';
8
8
  import { resolveTaskRef } from './resolve-ref.ts';
9
9
  import type { TaskWorkspaceState } from './resolve-ref.ts';
10
- import { allowsManualOverride } from './guard-override.ts';
11
- import type { ManualOverrideCapability } from './guard-override.ts';
12
10
 
13
11
  type VerificationEvent =
14
12
  | 'analyze.awaiting-input' | 'analyze.completed'
@@ -50,7 +48,6 @@ type TaskVerificationResult = {
50
48
  type VerificationOptions = {
51
49
  repoRoot?: string;
52
50
  engine?: (input: Parameters<typeof verifyInProcess>[0]) => Record<string, unknown> | Promise<Record<string, unknown>>;
53
- manualOverride?: ManualOverrideCapability;
54
51
  };
55
52
 
56
53
  const gate = (skill: string, expectedState: VerificationSpec['expectedState'], artifactFamily?: ArtifactFamily): VerificationSpec => ({
@@ -98,7 +95,7 @@ async function verifyTaskEvent(request: { taskRef: string; event: string; artifa
98
95
  const resolved = resolveTaskRef(request.taskRef, { repoRoot: options.repoRoot });
99
96
  if (!resolved.ok) return failure(request, resolved.code, resolved.message, { taskId: resolved.taskId, skill: spec.skill, mode: spec.mode });
100
97
  const identity = { taskId: resolved.taskId, taskDir: resolved.taskDir, taskState: resolved.state, skill: spec.skill, mode: spec.mode } as const;
101
- if (resolved.state !== spec.expectedState && !allowsManualOverride(options.manualOverride, 'task-verify', 'VERIFY_TASK_STATE_MISMATCH')) {
98
+ if (resolved.state !== spec.expectedState) {
102
99
  return failure(request, 'VERIFY_TASK_STATE_MISMATCH', `event '${request.event}' requires workspace '${spec.expectedState}', received '${resolved.state}'`, identity);
103
100
  }
104
101
  if (spec.artifactFamily) {
@@ -116,22 +113,11 @@ async function verifyTaskEvent(request: { taskRef: string; event: string; artifa
116
113
  if (spec.mode === 'gate') {
117
114
  const payload = await engine({ mode: 'gate', skillName: spec.skill, taskDir: resolved.taskDir, artifactFile: request.artifact, checks: [], repositoryRoot: resolved.repoRoot });
118
115
  const status = payload.gate as 'pass' | 'fail' | 'blocked';
119
- if (status !== 'pass' && allowsManualOverride(options.manualOverride, 'verification-engine', status === 'blocked' ? 'CHECK_BLOCKED' : 'CHECK_FAILED')) {
120
- invocations.push({ status: 'pass', exitCode: 0, payload: { ...payload, gate: 'pass', humanOverride: 'human-approved', originalGate: status } });
121
- return {
122
- status: 'pass', changed: false, event: request.event, requestRef: request.taskRef,
123
- ...identity, artifact: request.artifact ?? null, invocations, error: null
124
- };
125
- }
126
116
  invocations.push({ status, exitCode: ({ pass: 0, fail: 1, blocked: 2 } as const)[status], payload });
127
117
  } else {
128
118
  for (const check of spec.checks ?? []) {
129
119
  const payload = await engine({ mode: 'checks', skillName: spec.skill, taskDir: resolved.taskDir, artifactFile: request.artifact, checks: [check], repositoryRoot: resolved.repoRoot });
130
120
  const status = (payload.effectiveStatus ?? payload.status) as 'pass' | 'fail' | 'blocked';
131
- if (status !== 'pass' && allowsManualOverride(options.manualOverride, 'verification-engine', status === 'blocked' ? 'CHECK_BLOCKED' : 'CHECK_FAILED')) {
132
- invocations.push({ status: 'pass', exitCode: 0, payload: { ...payload, status: 'pass', humanOverride: 'human-approved', originalStatus: status } });
133
- break;
134
- }
135
121
  invocations.push({ status, exitCode: ({ pass: 0, fail: 1, blocked: 2 } as const)[status], payload });
136
122
  if (status !== 'pass') break;
137
123
  }
@@ -12,7 +12,6 @@ import {
12
12
  import type { WorkflowWarning } from './workflow-warnings.ts';
13
13
  import { captureTaskWriteMetadata, writeTask } from './write.ts';
14
14
  import type { TaskMutation, TaskOperationSummary, TaskWriteOptions } from './write.ts';
15
- import { allowsManualOverride } from './guard-override.ts';
16
15
  import { retryHintForWarning, type OperationWarning } from './operation-outcome.ts';
17
16
 
18
17
  type WarningSeverity = 'IMPORTANT' | 'ACTION_REQUIRED';
@@ -77,8 +76,7 @@ function rowMutation(row: WorkflowWarning): TaskMutation {
77
76
  function applyWorkflowWarningIntent(intent: WorkflowWarningIntent, options: TaskWriteOptions = {}): WorkflowWarningIntentResult {
78
77
  const resolved = resolveTaskRef(intent.taskRef, { repoRoot: options.repoRoot });
79
78
  if (!resolved.ok) return failed(intent, resolved.code, resolved.message, resolved.taskId);
80
- const stateOverride = allowsManualOverride(options.manualOverride, 'workflow-warning', 'TASK_STATE_MISMATCH');
81
- if (resolved.state !== 'active' && !stateOverride) return failed(intent, 'TASK_STATE_MISMATCH', `task ${resolved.taskId} is ${resolved.state}, expected active`, resolved.taskId);
79
+ if (resolved.state !== 'active') return failed(intent, 'TASK_STATE_MISMATCH', `task ${resolved.taskId} is ${resolved.state}, expected active`, resolved.taskId);
82
80
  let content: string;
83
81
  let rows: WorkflowWarning[];
84
82
  try {
@@ -122,7 +120,7 @@ function applyWorkflowWarningIntent(intent: WorkflowWarningIntent, options: Task
122
120
  }
123
121
 
124
122
  const writeResult = writeTask({
125
- taskRef: intent.taskRef, expectedState: stateOverride ? resolved.state : 'active', mutations: [...sectionMutation(content), rowMutation(after)], dryRun: intent.dryRun
123
+ taskRef: intent.taskRef, expectedState: 'active', mutations: [...sectionMutation(content), rowMutation(after)], dryRun: intent.dryRun
126
124
  }, {
127
125
  ...options,
128
126
  taskLocation: { repoRoot: resolved.repoRoot, taskId: resolved.taskId, taskMdPath: resolved.taskMdPath, state: resolved.state },
package/lib/task/write.ts CHANGED
@@ -12,8 +12,6 @@ import type {
12
12
  ResolveTaskRefErrorCode,
13
13
  TaskWorkspaceState
14
14
  } from './resolve-ref.ts';
15
- import { allowsManualOverride } from './guard-override.ts';
16
- import type { ManualOverrideCapability } from './guard-override.ts';
17
15
  import { mutateTableRow, upsertSection } from './sections.ts';
18
16
  import { validateCurrentTaskContract } from './current-contract.ts';
19
17
  import { invalidationBlocks, parseInvalidationDocument } from './invalidation.ts';
@@ -163,7 +161,6 @@ type TaskWriteOptions = {
163
161
  metadataProvider?: () => TaskWriteMetadata;
164
162
  randomSuffix?: () => string;
165
163
  fileSystem?: Partial<TaskFileSystem>;
166
- manualOverride?: ManualOverrideCapability;
167
164
  invalidationContext?: 'standard' | 'source-completion' | 'reconcile';
168
165
  };
169
166
 
@@ -250,7 +247,7 @@ function writeTask(request: TaskWriteRequest, options: TaskWriteOptions = {}): T
250
247
  taskMdPath: resolved.taskMdPath,
251
248
  actualState: resolved.state
252
249
  };
253
- if (resolved.state !== request.expectedState && !allowsManualOverride(options.manualOverride, 'task.write', 'TASK_STATE_MISMATCH')) {
250
+ if (resolved.state !== request.expectedState) {
254
251
  return failure(
255
252
  request,
256
253
  identity,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitlab-ai/agent-infra",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Antigravity CLI, and OpenCode",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,7 +15,7 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
15
15
 
16
16
  ### Flow decision
17
17
 
18
- The analysis artifact must record the selected path, factual basis, unmet higher-path conditions, and factual upgrade triggers in `## Flow Decision`. The path is streamlined, standard, or full; file count, module count, and speculative risk cannot upgrade it by themselves.
18
+ The analysis artifact must record `Path`, `Basis`, `Unmet Higher-path Conditions`, and `Upgrade Triggers` exactly once each, with non-empty values, in `## Flow Decision`. The path is streamlined, standard, or full; file count, module count, and speculative risk cannot upgrade it by themselves. The analysis `finalize-local` reuses the lifecycle-path parser to validate this decision; directly repair the formal artifact and rerun it for missing, duplicate, or invalid values.
19
19
 
20
20
  ### Persisted Report Evidence
21
21
 
@@ -160,7 +160,7 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
160
160
 
161
161
  ## State Check
162
162
 
163
- > Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts; each command starts with `$ `. Do not paste complete directory listings or task tails on normal success; retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes.
163
+ > Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts. Do not paste complete directory listings or task tails on normal success; retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes.
164
164
 
165
165
  ## Requirement Source
166
166
 
@@ -187,6 +187,15 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
187
187
  ## Dependencies
188
188
  - {Required dependencies and coordination with other modules}
189
189
 
190
+ <!-- lifecycle-path-decision-template:start -->
191
+ ## Flow Decision
192
+
193
+ - **Path**: {lifecycle-path}
194
+ - **Basis**: {Factual basis for selecting the current path}
195
+ - **Unmet Higher-path Conditions**: {Factual conditions for the higher path that are not met; for full, state that no higher path exists}
196
+ - **Upgrade Triggers**: {Factual triggers that require reassessing the path}
197
+ <!-- lifecycle-path-decision-template:end -->
198
+
190
199
  ## Assumptions
191
200
 
192
201
  > If this analysis depends on assumptions, list them here; omit this section if there are none.
@@ -15,7 +15,7 @@ description: >
15
15
 
16
16
  ### 流程裁定
17
17
 
18
- 分析产物必须在 `## 流程裁定` 中记录本任务路径、判定依据、未满足的更高路径条件和事实型升级触发条件。路径仅可为精简、标准或完整;文件数、模块数和推测性风险不能单独升级路径。
18
+ 分析产物必须在 `## 流程裁定` 中记录 `本任务路径`、`判定依据`、`未满足的更高路径条件` 和 `升级触发条件` 四个字段,每个字段恰好一次且非空。路径仅可为精简、标准或完整;文件数、模块数和推测性风险不能单独升级路径。analysis 的 `finalize-local` 会复用生命周期路径解析器校验该决定;缺失、重复或无效值必须直接修复正式产物后重跑。
19
19
 
20
20
  ### 持久化报告证据
21
21
 
@@ -163,7 +163,7 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
163
163
 
164
164
  ## 状态核对
165
165
 
166
- > 记录第 0 步状态核对命令、任务/产物范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。正常成功不粘贴完整目录清单或 `task.md` 尾部,失败、阻塞、身份不一致或争议时附决定性原文行。
166
+ > 记录第 0 步状态核对命令、任务/产物范围、关键结果和未覆盖部分。正常成功不粘贴完整目录清单或 `task.md` 尾部,失败、阻塞、身份不一致或争议时附决定性原文行。
167
167
 
168
168
  ## 需求来源
169
169
 
@@ -190,6 +190,15 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
190
190
  ## 依赖关系
191
191
  - {需要的依赖和与其他模块的协调}
192
192
 
193
+ <!-- lifecycle-path-decision-template:start -->
194
+ ## 流程裁定
195
+
196
+ - **本任务路径**:{lifecycle-path}
197
+ - **判定依据**:{选择当前路径的事实依据}
198
+ - **未满足的更高路径条件**:{当前未满足的更高路径条件;完整路径写不存在更高路径的事实}
199
+ - **升级触发条件**:{未来需要重新评估路径的事实触发条件}
200
+ <!-- lifecycle-path-decision-template:end -->
201
+
193
202
  ## 资格审计
194
203
 
195
204
  > 按 `.agents/rules/decision-qualification.md` 填写约束依赖、候选资格、分类结果、上游关系、依赖快照五张表;没有 artifact 上游时保留空表头,不虚构关系。
@@ -102,25 +102,25 @@ Use this structure when creating `code.md` or `code-r{N}.md`.
102
102
 
103
103
  ## State Check
104
104
 
105
- > Record the state-check command, task/artifact scope, key result, and uncovered parts; each command starts with `$ `.
105
+ > Record the state-check command, task/artifact scope, key result, and uncovered parts.
106
106
  > Follow `.agents/rules/evidence-reporting.md`: record task/artifact scope, key result, and uncovered parts; do not paste complete successful stdout.
107
107
 
108
- Record at least one actually executed `$ ` command and its result summary; prose-only status is insufficient. An implementation-stage report normally includes:
108
+ Record at least one actually executed command and its result summary; prose-only status is insufficient. An implementation-stage report normally includes:
109
109
 
110
110
  ```text
111
- $ agent-infra-internal task-snapshot {task-id} --format text
111
+ agent-infra-internal task-snapshot {task-id} --format text
112
112
  {task state, implementation-artifact scope, and uncovered-area summary}
113
- $ agent-infra-internal task-artifact {task-id} inspect --family code
113
+ agent-infra-internal task-artifact {task-id} inspect --family code
114
114
  {code artifact, upstream input, and next-step summary}
115
115
  ```
116
116
 
117
117
  ## Raw Evidence
118
118
 
119
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; include a decisive raw excerpt only for failures, blocking conditions, or disputes.
119
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; include a decisive raw excerpt only for failures, blocking conditions, or disputes.
120
120
 
121
121
  - Claim: {verified claim}
122
122
  ```text
123
- $ {command}
123
+ {command}
124
124
  {result summary or decisive excerpt}
125
125
  ```
126
126
 
@@ -102,25 +102,25 @@
102
102
 
103
103
  ## 状态核对
104
104
 
105
- > 记录状态核对命令、任务/产物范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
105
+ > 记录状态核对命令、任务/产物范围、关键结果和未覆盖部分。
106
106
  > 按 `.agents/rules/evidence-reporting.md` 同时记录任务/产物范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
107
107
 
108
- 必须记录至少一条实际执行的 `$ ` 命令及其结果摘要,不能只写自然语言状态。实现阶段通常包括:
108
+ 必须记录至少一条实际执行的命令及其结果摘要,不能只写自然语言状态。实现阶段通常包括:
109
109
 
110
110
  ```text
111
- $ agent-infra-internal task-snapshot {task-id} --format text
111
+ agent-infra-internal task-snapshot {task-id} --format text
112
112
  {任务状态、实现产物范围和未覆盖项摘要}
113
- $ agent-infra-internal task-artifact {task-id} inspect --family code
113
+ agent-infra-internal task-artifact {task-id} inspect --family code
114
114
  {code artifact、上游输入和下一步摘要}
115
115
  ```
116
116
 
117
117
  ## 证据原文
118
118
 
119
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;仅为失败、阻塞或争议附决定性原文摘录。
119
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;仅为失败、阻塞或争议附决定性原文摘录。
120
120
 
121
121
  - 断言:{verified claim}
122
122
  ```text
123
- $ {command}
123
+ {command}
124
124
  {result summary or decisive excerpt}
125
125
  ```
126
126
 
@@ -23,8 +23,8 @@
23
23
  "Validation Details",
24
24
  "PR Summary Sync"
25
25
  ],
26
- "required_patterns": [
27
- "^\\$ "
26
+ "state_check_patterns": [
27
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
28
28
  ]
29
29
  },
30
30
  "activity-log": {
@@ -23,8 +23,8 @@
23
23
  "验证详情",
24
24
  "PR 摘要同步"
25
25
  ],
26
- "required_patterns": [
27
- "^\\$ "
26
+ "state_check_patterns": [
27
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
28
28
  ]
29
29
  },
30
30
  "activity-log": {
@@ -12,9 +12,7 @@ Read this file before creating `manual-validation.md` / `manual-validation-r{N}.
12
12
  ## State Check
13
13
 
14
14
  ```text
15
- $ git status -s
16
- $ ls -la .agents/workspace/active/{task-id}/
17
- $ tail .agents/workspace/active/{task-id}/task.md
15
+ agent-infra-internal task-snapshot {task-id} --format text
18
16
  ```
19
17
  > Follow `.agents/rules/evidence-reporting.md`: record task scope, key result, and uncovered parts; do not paste the complete directory listing or task tail for normal success.
20
18
 
@@ -12,9 +12,7 @@
12
12
  ## 状态核对
13
13
 
14
14
  ```text
15
- $ git status -s
16
- $ ls -la .agents/workspace/active/{task-id}/
17
- $ tail .agents/workspace/active/{task-id}/task.md
15
+ agent-infra-internal task-snapshot {task-id} --format text
18
16
  ```
19
17
  > 按 `.agents/rules/evidence-reporting.md` 记录任务范围、关键结果和未覆盖部分;正常成功不粘贴完整目录清单或 task tail。
20
18
 
@@ -38,8 +38,8 @@
38
38
  "required_sections": [
39
39
  "State Check"
40
40
  ],
41
- "required_patterns": [
42
- "^\\$ "
41
+ "state_check_patterns": [
42
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
43
43
  ]
44
44
  }
45
45
  }
@@ -38,8 +38,8 @@
38
38
  "required_sections": [
39
39
  "状态核对"
40
40
  ],
41
- "required_patterns": [
42
- "^\\$ "
41
+ "state_check_patterns": [
42
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
43
43
  ]
44
44
  }
45
45
  }
@@ -147,16 +147,16 @@ Use this template when writing `review-analysis.md` or `review-analysis-r{N}.md`
147
147
 
148
148
  ## State Check
149
149
 
150
- > Record the state-check command, review scope, key result, and uncovered parts; each command starts with `$ `.
150
+ > Record the state-check command, review scope, key result, and uncovered parts.
151
151
  > Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
152
152
 
153
153
  ## Raw Evidence
154
154
 
155
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
155
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
156
156
 
157
157
  - Claim: {verified claim}
158
158
  ```text
159
- $ {command}
159
+ {command}
160
160
  {result summary or decisive excerpt}
161
161
  ```
162
162
 
@@ -147,16 +147,16 @@
147
147
 
148
148
  ## 状态核对
149
149
 
150
- > 记录状态核对命令、审查范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
150
+ > 记录状态核对命令、审查范围、关键结果和未覆盖部分。
151
151
  > 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
152
152
 
153
153
  ## 证据原文
154
154
 
155
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
155
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
156
156
 
157
157
  - 断言:{verified claim}
158
158
  ```text
159
- $ {command}
159
+ {command}
160
160
  {result summary or decisive excerpt}
161
161
  ```
162
162
 
@@ -153,16 +153,16 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
153
153
 
154
154
  ## State Check
155
155
 
156
- > Record the state-check command, review scope, key result, and uncovered parts; each command starts with `$ `.
156
+ > Record the state-check command, review scope, key result, and uncovered parts.
157
157
  > Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
158
158
 
159
159
  ## Raw Evidence
160
160
 
161
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require reproducible evidence, exact location, and a decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
161
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require reproducible evidence, exact location, and a decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
162
162
 
163
163
  - Claim: {verified claim}
164
164
  ```text
165
- $ {command}
165
+ {command}
166
166
  {result summary or decisive excerpt}
167
167
  ```
168
168
 
@@ -153,16 +153,16 @@
153
153
 
154
154
  ## 状态核对
155
155
 
156
- > 记录状态核对命令、审查范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
156
+ > 记录状态核对命令、审查范围、关键结果和未覆盖部分。
157
157
  > 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
158
158
 
159
159
  ## 证据原文
160
160
 
161
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现证据、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
161
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现证据、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
162
162
 
163
163
  - 断言:{verified claim}
164
164
  ```text
165
- $ {command}
165
+ {command}
166
166
  {result summary or decisive excerpt}
167
167
  ```
168
168
 
@@ -157,16 +157,16 @@ Use this template when writing `review-plan.md` or `review-plan-r{N}.md`.
157
157
 
158
158
  ## State Check
159
159
 
160
- > Record the state-check command, review scope, key result, and uncovered parts; each command starts with `$ `.
160
+ > Record the state-check command, review scope, key result, and uncovered parts.
161
161
  > Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
162
162
 
163
163
  ## Raw Evidence
164
164
 
165
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
165
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
166
166
 
167
167
  - Claim: {verified claim}
168
168
  ```text
169
- $ {command}
169
+ {command}
170
170
  {result summary or decisive excerpt}
171
171
  ```
172
172
 
@@ -157,16 +157,16 @@
157
157
 
158
158
  ## 状态核对
159
159
 
160
- > 记录状态核对命令、审查范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
160
+ > 记录状态核对命令、审查范围、关键结果和未覆盖部分。
161
161
  > 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
162
162
 
163
163
  ## 证据原文
164
164
 
165
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
165
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
166
166
 
167
167
  - 断言:{verified claim}
168
168
  ```text
169
- $ {command}
169
+ {command}
170
170
  {result summary or decisive excerpt}
171
171
  ```
172
172
 
@@ -12,8 +12,10 @@
12
12
  "State Check",
13
13
  "Evidence"
14
14
  ],
15
+ "state_check_patterns": [
16
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
17
+ ],
15
18
  "required_patterns": [
16
- "^\\$ ",
17
19
  "^- \\*\\*Reviewed Head SHA\\*\\*[::]\\s*[0-9a-f]{40}\\s*$",
18
20
  "^- \\*\\*Review Mode\\*\\*[::]\\s*(?:verify|audit|reconstruct)\\s*$",
19
21
  "^- \\*\\*Evidence Scenario\\*\\*[::]\\s*S[123]\\s*$",
@@ -12,8 +12,10 @@
12
12
  "状态核对",
13
13
  "证据原文"
14
14
  ],
15
+ "state_check_patterns": [
16
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
17
+ ],
15
18
  "required_patterns": [
16
- "^\\$ ",
17
19
  "^- \\*\\*被审 head SHA\\*\\*[::]\\s*[0-9a-f]{40}\\s*$",
18
20
  "^- \\*\\*审查模式\\*\\*[::]\\s*(?:verify|audit|reconstruct)\\s*$",
19
21
  "^- \\*\\*证据场景\\*\\*[::]\\s*S[123]\\s*$",
@@ -11,7 +11,7 @@ Use the following structure when creating `pr-review.md` or `pr-review-r{N}.md`.
11
11
 
12
12
  ## State Check
13
13
 
14
- > Record the state-check command, PR/head, review scope, key result, and uncovered parts; each command starts with `$ `.
14
+ > Record the state-check command, PR/head, review scope, key result, and uncovered parts.
15
15
  > Follow `.agents/rules/evidence-reporting.md`: record PR, head, review scope, key result, and uncovered parts; do not paste complete successful stdout.
16
16
 
17
17
  ## Identity
@@ -77,10 +77,10 @@ Land the following in order before the line-level findings, without impersonatin
77
77
 
78
78
  ## Evidence
79
79
 
80
- > Follow `.agents/rules/evidence-reporting.md`: pair every assertion with a `$ ` command and proportionate result summary; formal Review, failures, blocking conditions, or disputes retain exact identity and decisive excerpts.
80
+ > Follow `.agents/rules/evidence-reporting.md`: pair every assertion with an executable command and proportionate result summary; formal Review, failures, blocking conditions, or disputes retain exact identity and decisive excerpts.
81
81
 
82
82
  - Assertion: {verified claim}
83
83
  ```text
84
- $ {command}
84
+ {command}
85
85
  {result summary or decisive excerpt}
86
86
  ```
@@ -11,7 +11,7 @@
11
11
 
12
12
  ## 状态核对
13
13
 
14
- > 记录状态核对命令、PR/head、审查范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
14
+ > 记录状态核对命令、PR/head、审查范围、关键结果和未覆盖部分。
15
15
  > 按 `.agents/rules/evidence-reporting.md` 同时记录 PR、head、审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
16
16
 
17
17
  ## 身份信息
@@ -77,10 +77,10 @@
77
77
 
78
78
  ## 证据原文
79
79
 
80
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;正式 Review、失败、阻塞或争议保留准确身份和决定性摘录。
80
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;正式 Review、失败、阻塞或争议保留准确身份和决定性摘录。
81
81
 
82
82
  - 断言:{verified claim}
83
83
  ```text
84
- $ {command}
84
+ {command}
85
85
  {result summary or decisive excerpt}
86
86
  ```