@elvis1513/auto-coding-skill 4.1.2 → 4.1.3

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.
package/README.md CHANGED
@@ -9,7 +9,8 @@ The Skill is a selectable guardrail, not a command sequence that must run for
9
9
  every task. The model skips machinery whose expected benefit does not exceed its
10
10
  cost; read-only work and obvious small clean-checkout changes normally stay direct.
11
11
 
12
- Version 4.1.2 makes the workflow decision explicit: mechanisms are required,
12
+ Version 4.1.3 closes classification bypasses and keeps current-task changes direct
13
+ without weakening dirty-workspace isolation. Version 4.1.2 made mechanisms required,
13
14
  model-selectable when beneficial, or forbidden for the current task. Version
14
15
  4.1.1 consolidated the 4.x delivery-first workflow into one canonical
15
16
  repository contract. Version 4.0 replaced the 3.x governance-first defaults with progressive
@@ -67,17 +68,24 @@ The result includes:
67
68
  - `execution_mode=isolated`: dirty checkout, explicit isolation, or multiple writers.
68
69
  - `execution_mode=none`: no task signal or change; create no branch/worktree.
69
70
  - `review_required` and `design_required`: risk-based escalation decisions.
70
- - `task_kind`: `read_only`, `change`, `terminal_maintenance`, or `none`.
71
+ - `task_kind`: `read_only`, `change`, `terminal_maintenance`, or internal `none`.
71
72
  - `mechanism_plan.required`: the complete minimum mechanism set for the task.
72
73
  - `mechanism_plan.optional_when_beneficial`: model-selectable mechanisms whose
73
74
  expected benefit must exceed coordination cost.
74
75
  - `mechanism_plan.forbidden`: mechanisms that stay off unless the user overrides.
76
+ - `optional_agents`: model-selectable explorer/docs/browser candidates; they are
77
+ never automatic stages.
75
78
  - an adaptive agent plan that does not force fan-out for ordinary work.
76
79
 
77
80
  Clean serial work proceeds directly on the current branch with normal Git; it does
78
81
  not create machine lifecycle state. Use `task-start` only when classification
79
82
  requires isolation/review or the user explicitly requests lifecycle tracking:
80
83
 
84
+ When a direct task materially changes scope after writing, reclassify with
85
+ `--continue-direct` and repeat every current task `--planned-path`. Undeclared
86
+ dirty paths, another writer, or mandatory isolation still selects a worktree. If
87
+ the new plan requires review lifecycle, reuse `--continue-direct` on `task-start`.
88
+
81
89
  ```bash
82
90
  python3 docs/tools/autopipeline/ap.py task-start T0001 \
83
91
  --owned-path backend/internal/orders --force-lifecycle
@@ -97,7 +105,8 @@ python3 docs/tools/autopipeline/ap.py task-start T0002 \
97
105
  # implement in the printed worktree
98
106
  python3 docs/tools/autopipeline/ap.py task-status T0002 --json
99
107
  python3 docs/tools/autopipeline/ap.py task-review T0002 \
100
- --verdict approved --diff-fingerprint "$CURRENT_DIFF_FINGERPRINT"
108
+ --verdict approved --diff-fingerprint "$CURRENT_DIFF_FINGERPRINT" \
109
+ --reviewer "$REVIEWER_ID"
101
110
  python3 docs/tools/autopipeline/ap.py commit-push T0002 \
102
111
  --msg "T0002: bounded change"
103
112
  python3 docs/tools/autopipeline/ap.py task-integrate T0002
@@ -200,6 +209,19 @@ project-specific facts outside the managed ENGINEERING block. Root `AGENTS.md` i
200
209
  replaced as a whole; its previous content is archived under
201
210
  `docs/archive/workflow/` as historical, non-authoritative context.
202
211
 
212
+ ## What changed in 4.1.3
213
+
214
+ - Made explicit task kinds fail closed: `none` is internal-only and terminal
215
+ maintenance cannot be applied to code or unrelated documentation paths.
216
+ - Added guarded `--continue-direct` reclassification for already-owned changes;
217
+ unknown dirty paths still require isolation.
218
+ - Separated intent risk hints from path/rule-confirmed high risk so ordinary login
219
+ or payment UI work no longer automatically receives a heavy lifecycle.
220
+ - Aligned generated Agent plans with their JSON Schema and exposed optional
221
+ read-only Agent candidates without auto-dispatching them.
222
+ - Clarified delegated-fixer worktree ownership, reviewer identity, and explorer
223
+ source authority.
224
+
203
225
  ## What changed in 4.1.2
204
226
 
205
227
  - Added explicit read-only, change, and terminal-maintenance task kinds so
@@ -8,7 +8,7 @@ developer_instructions = """
8
8
 
9
9
  工作要求:
10
10
  1. 优先用 rg / git / 项目脚本快速定位真实入口,再向下追踪调用链。
11
- 2. 先读项目已有文档、配置、路由、任务记录;涉及结构/优化时,仅在结构标准、健康基线或优化 backlog 已存在时读取,不因可选文档缺失而阻塞。
11
+ 2. 以当前代码、测试、schema、migration 和运行配置为事实源;仅按任务需要读取 ENGINEERING 或当前接口文档,任务记录只在明确追溯历史时读取。涉及结构/优化时,仅在结构标准、健康基线或 optimization backlog 已存在时读取,不因可选文档缺失而阻塞。
12
12
  3. 必要时运行 `ap.py classify --scope auto`,说明执行模式、风险和是否确实需要设计/reviewer;普通任务默认主代理直接完成,本地 gate 始终保持 changed-scope。
13
13
  4. 输出根因时说明当前代码应归属的层级、现有同类模块、可复用 helper / 组件 / 脚本,以及是否触及 `structure.layer_rules`。
14
14
  5. 如果根因依赖外部库、框架或版本行为,标记需要 docs_researcher / Context7 继续核对,不要凭记忆猜。
@@ -7,9 +7,9 @@ developer_instructions = """
7
7
  你负责小而准的实现修改。
8
8
 
9
9
  工作要求:
10
- 1. 只在问题已经相对明确,并收到 task_id、execution_mode、owned_paths、depends_on 和 acceptance 后再动手;只有 delegated/isolated 工作才要求完整任务元数据。
11
- 2. direct 模式只用于单写入者且主代理确认当前 checkout 干净的当前分支;isolated 模式必须确认当前目录和 task_branch 与分配的注册 worktree 一致。不满足时停止并上报。
12
- 3. 一个 worktree 只能有一个写入者。只修改 owned_paths,不进入或修改其他任务工作树;发现未知改动立即停止,不 restore/reset/stash/clean。direct 模式期间主代理不得并发编辑同一 checkout。
10
+ 1. 只在问题已经相对明确,并收到 task_id、execution_mode、owned_paths、depends_on 和 acceptance 后再动手。
11
+ 2. fixer 属于 delegated writer,必须使用注册的 isolated worktree;direct 模式保留给干净 checkout 中独立开发的主代理。确认当前目录和 task_branch 与分配一致,否则停止并上报。
12
+ 3. 一个 worktree 只能有一个写入者。只修改 owned_paths,不进入其他任务工作树;发现未知改动立即停止,不 restore/reset/stash/clean。
13
13
  4. 坚持“最小可辩护修改”原则。
14
14
  5. 除非明确要求,否则不要重构、不做大面积改名、不改无关文件。
15
15
  6. 先跟随项目现有模式、helper、组件、脚本和文档约束,不新造不必要抽象。
@@ -31,19 +31,19 @@ python3 docs/tools/autopipeline/ap.py classify --scope auto \
31
31
  Run `mechanism_plan.required`. The model may select
32
32
  `optional_when_beneficial` only when expected value exceeds coordination cost.
33
33
  Do not run `forbidden` mechanisms unless the user explicitly overrides the plan.
34
- Reclassify only when task kind, scope, risk, or writer count materially changes.
35
- Ordinary direct work does not create a task lifecycle.
34
+ Reclassify only after material change. For already-direct work, add `--continue-direct`
35
+ with every task path and reuse it on `task-start` if needed; unknown dirt isolates.
36
36
 
37
37
  Use the registered lifecycle only when classification requires isolation or
38
38
  fingerprinted review, or when the user explicitly requests it:
39
39
 
40
40
  ```bash
41
41
  python3 docs/tools/autopipeline/ap.py task-start T0001 \
42
- --owned-path src [--isolated] [--review-required] [--force-lifecycle]
42
+ --owned-path src [--isolated] [--review-required] [--continue-direct] [--force-lifecycle]
43
43
  # For review-required work, obtain the current fingerprint and approve it:
44
44
  python3 docs/tools/autopipeline/ap.py task-status T0001 --json
45
45
  python3 docs/tools/autopipeline/ap.py task-review T0001 \
46
- --verdict approved --diff-fingerprint <CURRENT_DIFF_FINGERPRINT>
46
+ --verdict approved --diff-fingerprint <CURRENT_DIFF_FINGERPRINT> --reviewer <REVIEWER_ID>
47
47
  python3 docs/tools/autopipeline/ap.py commit-push T0001 --msg "T0001: summary"
48
48
  # Isolated tasks only:
49
49
  python3 docs/tools/autopipeline/ap.py task-integrate T0001
@@ -384,6 +384,7 @@
384
384
  "policies",
385
385
  "assignment_contract",
386
386
  "result_contract",
387
+ "optional_roles",
387
388
  "stages",
388
389
  "constraints"
389
390
  ],
@@ -409,6 +410,9 @@
409
410
  "result_contract": {
410
411
  "$ref": "#/$defs/stringArray"
411
412
  },
413
+ "optional_roles": {
414
+ "$ref": "#/$defs/stringArray"
415
+ },
412
416
  "stages": {
413
417
  "type": "array",
414
418
  "items": {
@@ -454,10 +458,12 @@
454
458
  "classification_files",
455
459
  "intent_provided",
456
460
  "intent_categories",
461
+ "intent_risk_candidates",
457
462
  "task_kind",
458
463
  "profile",
459
464
  "categories",
460
465
  "recommended_agents",
466
+ "optional_agents",
461
467
  "agent_plan",
462
468
  "mechanism_plan"
463
469
  ],
@@ -483,6 +489,9 @@
483
489
  "intent_categories": {
484
490
  "$ref": "#/$defs/stringArray"
485
491
  },
492
+ "intent_risk_candidates": {
493
+ "$ref": "#/$defs/stringArray"
494
+ },
486
495
  "task_kind": {
487
496
  "enum": ["none", "read_only", "change", "terminal_maintenance"]
488
497
  },
@@ -499,6 +508,9 @@
499
508
  "recommended_agents": {
500
509
  "$ref": "#/$defs/stringArray"
501
510
  },
511
+ "optional_agents": {
512
+ "$ref": "#/$defs/stringArray"
513
+ },
502
514
  "agent_plan": {
503
515
  "$ref": "#/$defs/agentPlan"
504
516
  },
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "managed_versions": {
4
- "agents": "4.1.2",
5
- "engineering": "4.1.2"
4
+ "agents": "4.1.3",
5
+ "engineering": "4.1.3"
6
6
  },
7
7
  "known_official_agents_sha256": [
8
8
  "ebaaadab60327b3a4852948443d7191a4d48cb00bf4910038ab78c9149089373"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  workflow:
3
- skill_version: "4.1.2"
3
+ skill_version: "4.1.3"
4
4
  mode: "dev"
5
5
  profile: "auto"
6
6
  completion: "push"
@@ -94,7 +94,7 @@ docs:
94
94
 
95
95
  # Engineering Configuration and Project Facts
96
96
 
97
- <!-- auto-coding-skill:managed-workflow:start version=4.1.2 -->
97
+ <!-- auto-coding-skill:managed-workflow:start version=4.1.3 -->
98
98
 
99
99
  Root `AGENTS.md` is the single shared behavioral protocol. The installed
100
100
  `SKILL.md` contains invocation guidance. This file is the single source for the
@@ -1,4 +1,4 @@
1
- <!-- auto-coding-skill:managed-agents:start version=4.1.2 -->
1
+ <!-- auto-coding-skill:managed-agents:start version=4.1.3 -->
2
2
  # Shared Engineering Protocol
3
3
 
4
4
  This file is fully managed by `auto-coding-skill`. Keep project-specific facts,
@@ -51,11 +51,11 @@ failure may continue in the same conversation/task without a second lifecycle.
51
51
 
52
52
  ## Git and parallel work
53
53
 
54
- - One writer in a clean checkout works directly on the current branch without a
55
- task lifecycle.
54
+ - One writer in a clean checkout works directly without a lifecycle. On
55
+ reclassification, `--continue-direct` requires every dirty path to be declared.
56
56
  - Existing unrelated changes, another writer, or configured mandatory isolation
57
57
  requires a registered task branch/worktree.
58
- - Every writing agent owns a distinct task ID, worktree, writer lease,
58
+ - Every delegated fixer or parallel writer owns a task ID/worktree, writer lease,
59
59
  non-overlapping `owned_paths`, and prerequisite commit SHAs.
60
60
  - Never let multiple writing agents share a checkout. Never restore, reset, stash,
61
61
  clean, overwrite, or commit unknown changes.
@@ -73,8 +73,8 @@ failure may continue in the same conversation/task without a second lifecycle.
73
73
  or key user-flow decisions.
74
74
  - Use read-only explorer/docs/browser agents only for independent questions.
75
75
  - Use parallel fixers only for bounded, dependency-free, non-overlapping units.
76
- - Require fingerprinted review only for high-risk, contract-crossing, parallel,
77
- or explicitly configured work.
76
+ - Require fingerprinted review only for path/rule-confirmed high-risk,
77
+ contract-crossing, parallel, or configured work; intent words are candidates only.
78
78
  - Review blocks only defects introduced or worsened in the promised scope.
79
79
  Adjacent existing issues are non-blocking follow-ups.
80
80
  - Semantic changes invalidate approval. Mechanical documentation-only corrections
@@ -51,7 +51,7 @@ _RECOMMENDED_FINAL_TOTAL_SECONDS = 180.0
51
51
  _WORKFLOW_MIGRATION_POLICY = Path("data/policies/workflow-migrations-v1.json")
52
52
  _FALLBACK_WORKFLOW_MIGRATION_POLICY = {
53
53
  "schema_version": 1,
54
- "managed_versions": {"agents": "4.1.2", "engineering": "4.1.2"},
54
+ "managed_versions": {"agents": "4.1.3", "engineering": "4.1.3"},
55
55
  "known_official_engineering_body_sha256": [
56
56
  "d1306cc626e8baf8c83c953b760fd771066de2bf125168eca3a7b7d6ff2b87a2",
57
57
  "305931c6edef770033a4f1970b00e5fb1c1728351856a173dbfa497daf563021",
@@ -638,8 +638,8 @@ def _migrate_fast_development_defaults(cfg: dict, repo: Path) -> list[str]:
638
638
  if _text(workflow_cfg.get("completion")).lower() != "push":
639
639
  workflow_cfg["completion"] = "push"
640
640
  changed.append("workflow.completion")
641
- if _text(workflow_cfg.get("skill_version")) != "4.1.2":
642
- workflow_cfg["skill_version"] = "4.1.2"
641
+ if _text(workflow_cfg.get("skill_version")) != "4.1.3":
642
+ workflow_cfg["skill_version"] = "4.1.3"
643
643
  changed.append("workflow.skill_version")
644
644
 
645
645
  commands_cfg = cfg.setdefault("commands", {})
@@ -952,16 +952,16 @@ def cmd_upgrade(args: argparse.Namespace) -> None:
952
952
  if current_agents:
953
953
  archive_dir = repo / "docs" / "archive" / "workflow"
954
954
  archive_header = (
955
- "# Archived AGENTS.md before auto-coding-skill 4.1.2\n\n"
955
+ "# Archived AGENTS.md before auto-coding-skill 4.1.3\n\n"
956
956
  "This file is historical and non-authoritative. The root AGENTS.md is fully managed.\n"
957
957
  "Move any still-current project facts into docs/ENGINEERING.md or docs/project/,\n"
958
958
  "without copying workflow rules back into the root AGENTS.md.\n\n---\n\n"
959
959
  )
960
960
  archive_content = archive_header + current_agents
961
- archive = archive_dir / "AGENTS.pre-4.1.2.md"
961
+ archive = archive_dir / "AGENTS.pre-4.1.3.md"
962
962
  if archive.exists() and archive.read_text(encoding="utf-8") != archive_content:
963
963
  digest = hashlib.sha256(current_agents.encode("utf-8")).hexdigest()[:12]
964
- archive = archive_dir / f"AGENTS.pre-4.1.2-{digest}.md"
964
+ archive = archive_dir / f"AGENTS.pre-4.1.3-{digest}.md"
965
965
  if not archive.exists():
966
966
  add_action("policy", archive, "archive", "historical and non-authoritative")
967
967
  if write:
@@ -2477,7 +2477,8 @@ def _resolve_secret(section_name: str, section_cfg: dict, field: str) -> str:
2477
2477
 
2478
2478
  _GATE_SCOPES = {"auto", "changed", "standard", "full"}
2479
2479
  _WORKFLOW_PROFILES = {"auto", "micro", "standard", "high-risk"}
2480
- _TASK_KINDS = {"auto", "none", "read_only", "change", "terminal_maintenance"}
2480
+ _TASK_KINDS = {"none", "read_only", "change", "terminal_maintenance"}
2481
+ _REQUESTED_TASK_KINDS = (_TASK_KINDS - {"none"}) | {"auto"}
2481
2482
  _PROFILE_GATE_SCOPE = {"micro": "changed", "standard": "changed", "high-risk": "changed"}
2482
2483
  _PROFILE_RANK = {"micro": 0, "standard": 1, "high-risk": 2}
2483
2484
  _SCOPE_RANK = {"changed": 0, "standard": 1, "full": 2}
@@ -4426,7 +4427,7 @@ def _classify_paths(paths: list[str]) -> dict:
4426
4427
  categories.add("api")
4427
4428
  if words & {"auth", "authentication", "authorization", "permission", "permissions", "role", "roles", "tenant", "security"}:
4428
4429
  categories.add("auth")
4429
- if words & {"payment", "payments", "billing", "invoice", "invoices", "checkout", "order", "orders"}:
4430
+ if words & {"payment", "payments", "billing", "invoice", "invoices", "checkout"}:
4430
4431
  categories.add("payment")
4431
4432
  if words & {"upload", "uploads", "download", "downloads", "attachment", "attachments"}:
4432
4433
  categories.add("file_transfer")
@@ -4494,17 +4495,13 @@ def _resolve_task_kind(
4494
4495
  intent: str,
4495
4496
  ) -> str:
4496
4497
  value = _text(requested).lower().replace("-", "_") or "auto"
4497
- if value not in _TASK_KINDS:
4498
- raise APError("task kind must be one of: " + ", ".join(sorted(_TASK_KINDS)))
4499
- if value != "auto":
4500
- return value
4498
+ if value not in _REQUESTED_TASK_KINDS:
4499
+ raise APError("task kind must be one of: " + ", ".join(sorted(_REQUESTED_TASK_KINDS)))
4501
4500
  if _is_terminal_ledger_maintenance(paths):
4501
+ if value in {"change", "read_only"}:
4502
+ return value
4502
4503
  return "terminal_maintenance"
4503
- if paths:
4504
- return "change"
4505
4504
  normalized_intent = _text(intent).lower()
4506
- if not normalized_intent:
4507
- return "none"
4508
4505
  terminal_action = bool(
4509
4506
  re.search(r"\b(archive|close|reconcile)\b", normalized_intent)
4510
4507
  or any(keyword in normalized_intent for keyword in ["归档", "对账", "收口"])
@@ -4514,7 +4511,22 @@ def _resolve_task_kind(
4514
4511
  or any(keyword in normalized_intent for keyword in ["台账", "任务记录", "关闭记录"])
4515
4512
  )
4516
4513
  if terminal_action and terminal_subject:
4517
- return "terminal_maintenance"
4514
+ detected = "terminal_maintenance"
4515
+ elif paths:
4516
+ detected = "change"
4517
+ elif not normalized_intent:
4518
+ detected = "none"
4519
+ else:
4520
+ detected = ""
4521
+ if value == "terminal_maintenance" and detected != "terminal_maintenance":
4522
+ raise APError(
4523
+ "terminal_maintenance is valid only for task ledger/closure/archive reconciliation; "
4524
+ "code or unrelated documentation paths require task-kind=change"
4525
+ )
4526
+ if value != "auto":
4527
+ return value
4528
+ if detected:
4529
+ return detected
4518
4530
  english_change = re.search(
4519
4531
  r"\b(add|build|change|create|delete|deploy|develop|fix|implement|migrate|optimize|publish|refactor|release|remove|rename|resolve|update|upgrade)\b",
4520
4532
  normalized_intent,
@@ -4529,6 +4541,36 @@ def _resolve_task_kind(
4529
4541
  return "change" if english_change or chinese_change else "read_only"
4530
4542
 
4531
4543
 
4544
+ def _optional_agent_candidates(
4545
+ *,
4546
+ task_kind: str,
4547
+ intent: str,
4548
+ categories: set[str],
4549
+ cross_module: bool,
4550
+ profile: str,
4551
+ ) -> list[str]:
4552
+ if task_kind not in {"read_only", "change"}:
4553
+ return []
4554
+ value = _text(intent).lower()
4555
+ roles: list[str] = []
4556
+ if task_kind == "read_only" or cross_module or profile == "high-risk":
4557
+ roles.append("explorer")
4558
+ if any(
4559
+ keyword in value
4560
+ for keyword in [
4561
+ "documentation", "docs", "framework", "library", "official", "sdk", "version",
4562
+ "依赖", "官方", "文档", "框架", "版本",
4563
+ ]
4564
+ ):
4565
+ roles.append("docs_researcher")
4566
+ if "ui" in categories and any(
4567
+ keyword in value
4568
+ for keyword in ["broken", "bug", "error", "fail", "fix", "reproduce", "报错", "复现", "失败", "异常", "修复"]
4569
+ ):
4570
+ roles.append("browser_debugger")
4571
+ return roles
4572
+
4573
+
4532
4574
  def _normalize_workflow_profile(value: object, default: str = "auto") -> str:
4533
4575
  profile = _text(value).lower() or default
4534
4576
  if profile not in _WORKFLOW_PROFILES:
@@ -4615,12 +4657,15 @@ def _validate_agent_plan(plan: dict) -> dict:
4615
4657
  "result_contract",
4616
4658
  "stages",
4617
4659
  "constraints",
4660
+ "optional_roles",
4618
4661
  }
4619
4662
  missing = sorted(required - set(plan))
4620
4663
  if missing or plan.get("contract_version") != _AGENT_CONTRACT_VERSION:
4621
4664
  raise APError("Invalid agent plan contract: " + (", ".join(missing) or "version"))
4622
4665
  if plan.get("contract_schema") != _AGENT_CONTRACT_SCHEMA:
4623
4666
  raise APError("Invalid agent plan schema path.")
4667
+ if plan.get("strategy") not in {"main-only", "orchestrated-subagents"}:
4668
+ raise APError("Invalid agent plan strategy.")
4624
4669
  if not all(
4625
4670
  isinstance(stage, dict)
4626
4671
  and {"id", "mode", "roles", "depends_on"} <= set(stage)
@@ -4637,11 +4682,12 @@ def _agent_execution_plan(
4637
4682
  *,
4638
4683
  parallel_writers: int = 1,
4639
4684
  review_required: bool = False,
4685
+ optional_roles: Optional[list[str]] = None,
4640
4686
  ) -> dict:
4641
4687
  assignment_contract, result_contract = _agent_contract_shape()
4642
- # Classification reports useful capabilities but never auto-dispatches
4643
- # discovery roles. The model chooses delegation only when expected benefit
4644
- # exceeds coordination cost.
4688
+ optional_roles = list(dict.fromkeys(optional_roles or []))
4689
+ # Optional roles are candidates, never automatic stages. The model selects
4690
+ # them only when expected benefit exceeds coordination cost.
4645
4691
  discovery_roles: list[str] = []
4646
4692
 
4647
4693
  policies = {
@@ -4694,7 +4740,7 @@ def _agent_execution_plan(
4694
4740
  "depends_on": [previous],
4695
4741
  }
4696
4742
  )
4697
- strategy = "parallel-writers" if parallel_writers > 1 else "risk-assisted"
4743
+ strategy = "orchestrated-subagents"
4698
4744
 
4699
4745
  return _validate_agent_plan({
4700
4746
  "contract_version": _AGENT_CONTRACT_VERSION,
@@ -4703,6 +4749,7 @@ def _agent_execution_plan(
4703
4749
  "policies": policies,
4704
4750
  "assignment_contract": assignment_contract,
4705
4751
  "result_contract": result_contract,
4752
+ "optional_roles": optional_roles,
4706
4753
  "stages": stages,
4707
4754
  "constraints": constraints,
4708
4755
  })
@@ -4786,6 +4833,7 @@ def _resolve_execution_plan(
4786
4833
  intent: str = "",
4787
4834
  parallel_writers: int = 1,
4788
4835
  requested_task_kind: str = "",
4836
+ continue_direct: bool = False,
4789
4837
  ) -> dict:
4790
4838
  impact = _impact_summary(
4791
4839
  cfg,
@@ -4800,9 +4848,10 @@ def _resolve_execution_plan(
4800
4848
  )
4801
4849
  classification_inputs = [*paths, *normalized_planned_paths]
4802
4850
  task_kind = _resolve_task_kind(requested_task_kind, classification_inputs, intent)
4803
- classification = _classify_paths(classification_inputs)
4851
+ path_classification = _classify_paths(classification_inputs)
4852
+ path_categories = set(path_classification["categories"])
4804
4853
  intent_categories = _classify_intent(intent)
4805
- merged_categories = set(classification["categories"]) | set(intent_categories)
4854
+ merged_categories = path_categories | set(intent_categories)
4806
4855
  classification = _classification_for_categories(merged_categories, len(classification_inputs))
4807
4856
  categories = set(classification["categories"])
4808
4857
  matching_rules = _matching_risk_rules(classification_inputs, cfg)
@@ -4851,9 +4900,22 @@ def _resolve_execution_plan(
4851
4900
  "prod_config",
4852
4901
  "release_or_tooling",
4853
4902
  }
4903
+ default_high_path_categories: set[str] = set()
4904
+ for path in classification_inputs:
4905
+ per_path = set(_classify_paths([path])["categories"])
4906
+ default_high_path_categories.update(
4907
+ per_path & {"db", "gateway", "prod_config", "release_or_tooling"}
4908
+ )
4909
+ if "ui" not in per_path:
4910
+ default_high_path_categories.update(
4911
+ per_path & {"auth", "payment", "file_transfer"}
4912
+ )
4913
+ intent_risk_candidates = sorted(set(intent_categories) & high_categories)
4854
4914
  high_signals: list[str] = []
4855
- if task_kind == "change" and categories & high_categories and not docs_or_tests_only:
4856
- high_signals.append("high-risk category: " + ", ".join(sorted(categories & high_categories)))
4915
+ if task_kind == "change" and default_high_path_categories and not docs_or_tests_only:
4916
+ high_signals.append(
4917
+ "high-risk path category: " + ", ".join(sorted(default_high_path_categories))
4918
+ )
4857
4919
  if task_kind == "change" and "high-risk" in rule_profiles:
4858
4920
  high_signals.append("matched gate rule with profile=high-risk")
4859
4921
  if high_signals:
@@ -4914,11 +4976,28 @@ def _resolve_execution_plan(
4914
4976
  task_kind == "change"
4915
4977
  and (rule_design or (effective_profile == "high-risk" and cross_module))
4916
4978
  )
4917
- workspace_dirty = bool(_working_tree_paths(repo))
4979
+ dirty_paths = _working_tree_paths(repo)
4980
+ workspace_dirty = bool(dirty_paths)
4981
+ dirty_outside_plan = [
4982
+ path for path in dirty_paths if not _path_is_owned(path, normalized_planned_paths)
4983
+ ] if normalized_planned_paths else list(dirty_paths)
4918
4984
  active_writer = _has_registered_active_task(repo)
4919
4985
  configured_isolation = _task_isolation(cfg)
4986
+ if continue_direct and task_kind != "change":
4987
+ raise APError("--continue-direct is valid only for task-kind=change")
4988
+ if continue_direct and not normalized_planned_paths:
4989
+ raise APError("--continue-direct requires every current task path via --planned-path")
4990
+ continued_direct = bool(
4991
+ continue_direct
4992
+ and configured_isolation == "adaptive"
4993
+ and writer_count == 1
4994
+ and not active_writer
4995
+ and not dirty_outside_plan
4996
+ )
4920
4997
  if task_kind != "change":
4921
4998
  execution_mode = "none"
4999
+ elif continued_direct:
5000
+ execution_mode = "direct"
4922
5001
  elif configured_isolation == "worktree" or writer_count > 1 or workspace_dirty or active_writer:
4923
5002
  execution_mode = "isolated"
4924
5003
  else:
@@ -4926,17 +5005,29 @@ def _resolve_execution_plan(
4926
5005
  execution_reasons.append(
4927
5006
  "execution mode is adaptive: clean single-writer work is direct; dirty or parallel work is isolated"
4928
5007
  )
5008
+ if continued_direct:
5009
+ execution_reasons.append(
5010
+ "continued direct mode: all current dirty paths are covered by declared planned paths"
5011
+ )
4929
5012
 
4930
5013
  needs_jenkins = False
4931
5014
  needs_target = False
4932
5015
  needs_dd = design_required
4933
5016
 
5017
+ optional_agents = _optional_agent_candidates(
5018
+ task_kind=task_kind,
5019
+ intent=intent,
5020
+ categories=categories,
5021
+ cross_module=cross_module,
5022
+ profile=effective_profile,
5023
+ )
4934
5024
  agent_plan = _agent_execution_plan(
4935
5025
  effective_profile,
4936
5026
  categories,
4937
5027
  classification,
4938
5028
  parallel_writers=writer_count,
4939
5029
  review_required=review_required,
5030
+ optional_roles=optional_agents,
4940
5031
  )
4941
5032
  mechanism_plan = _mechanism_plan(
4942
5033
  task_kind=task_kind,
@@ -4954,6 +5045,7 @@ def _resolve_execution_plan(
4954
5045
  "intent_provided": bool(_text(intent)),
4955
5046
  "task_kind": task_kind,
4956
5047
  "intent_categories": intent_categories,
5048
+ "intent_risk_candidates": intent_risk_candidates,
4957
5049
  "reasons": execution_reasons,
4958
5050
  "configured_profile": configured_profile,
4959
5051
  "requested_profile": requested_profile_value or None,
@@ -4965,6 +5057,9 @@ def _resolve_execution_plan(
4965
5057
  "execution_mode": execution_mode,
4966
5058
  "terminal_maintenance": terminal_maintenance,
4967
5059
  "workspace_dirty": workspace_dirty,
5060
+ "dirty_paths": dirty_paths,
5061
+ "dirty_outside_plan": dirty_outside_plan,
5062
+ "continued_direct": continued_direct,
4968
5063
  "active_writer": active_writer,
4969
5064
  "parallel_writers": writer_count,
4970
5065
  "cross_module": cross_module,
@@ -4984,6 +5079,7 @@ def _resolve_execution_plan(
4984
5079
  parallel_writers=writer_count,
4985
5080
  review_required=review_required,
4986
5081
  ),
5082
+ "optional_agents": optional_agents,
4987
5083
  "agent_plan": agent_plan,
4988
5084
  "mechanism_plan": mechanism_plan,
4989
5085
  }
@@ -5015,6 +5111,7 @@ def cmd_classify(args: argparse.Namespace) -> None:
5015
5111
  intent="\n".join(part for part in intent_parts if part),
5016
5112
  parallel_writers=int(getattr(args, "writers", 1) or 1),
5017
5113
  requested_task_kind=_text(getattr(args, "task_kind", "")),
5114
+ continue_direct=bool(getattr(args, "continue_direct", False)),
5018
5115
  )
5019
5116
  risk = {"micro": "P3", "standard": "P2", "high-risk": "P1"}[plan["profile"]]
5020
5117
  commands: list[str] = []
@@ -5038,6 +5135,10 @@ def cmd_classify(args: argparse.Namespace) -> None:
5038
5135
  print(f"[classify] selected_scope={result['selected_scope']}")
5039
5136
  print("[classify] categories=" + (", ".join(result["categories"]) or "(none)"))
5040
5137
  print("[classify] agents=" + (", ".join(result["recommended_agents"]) or "(main agent only)"))
5138
+ print(
5139
+ "[classify] optional_agents="
5140
+ + (", ".join(result["optional_agents"]) or "(none)")
5141
+ )
5041
5142
  print(f"[classify] agent_strategy={result['agent_plan']['strategy']}")
5042
5143
  print(
5043
5144
  "[classify] required_mechanisms="
@@ -6744,10 +6845,12 @@ def cmd_task_start(args: argparse.Namespace) -> None:
6744
6845
  "task-start creates exactly one writer lease and one worktree. Start each parallel "
6745
6846
  "writer as its own task ID; use --writers only with classify for planning."
6746
6847
  )
6848
+ continue_direct = bool(getattr(args, "continue_direct", False))
6747
6849
  explicit_lifecycle = bool(
6748
6850
  getattr(args, "isolated", False)
6749
6851
  or getattr(args, "review_required", False)
6750
6852
  or getattr(args, "force_lifecycle", False)
6853
+ or continue_direct
6751
6854
  )
6752
6855
  preflight_plan = _resolve_execution_plan(
6753
6856
  cfg,
@@ -6755,7 +6858,14 @@ def cmd_task_start(args: argparse.Namespace) -> None:
6755
6858
  planned_paths=owned_paths,
6756
6859
  parallel_writers=writer_count,
6757
6860
  requested_task_kind="change",
6861
+ continue_direct=continue_direct,
6758
6862
  )
6863
+ if continue_direct and preflight_plan["execution_mode"] != "direct":
6864
+ detail = ", ".join(preflight_plan["dirty_outside_plan"]) or "policy or active-writer conflict"
6865
+ raise APError(
6866
+ "Cannot continue the existing direct task because isolation is still required: "
6867
+ + detail
6868
+ )
6759
6869
  if not preflight_plan["mechanism_plan"]["lifecycle_required"] and not explicit_lifecycle:
6760
6870
  raise APError(
6761
6871
  "This clean serial task does not need a machine task lifecycle. Work directly on "
@@ -6827,6 +6937,7 @@ def cmd_task_start(args: argparse.Namespace) -> None:
6827
6937
  planned_paths=owned_paths,
6828
6938
  parallel_writers=writer_count,
6829
6939
  requested_task_kind="change",
6940
+ continue_direct=continue_direct,
6830
6941
  )
6831
6942
  if not plan["mechanism_plan"]["lifecycle_required"] and not explicit_lifecycle:
6832
6943
  raise APError(
@@ -6845,15 +6956,25 @@ def cmd_task_start(args: argparse.Namespace) -> None:
6845
6956
  )
6846
6957
  ) if registry_dir.exists() else False
6847
6958
  current_branch = _current_branch(repo)
6959
+ task_paths = _task_commit_paths(repo)
6960
+ direct_changes_owned = bool(
6961
+ continue_direct
6962
+ and all(_path_is_owned(path, owned_paths) for path in task_paths)
6963
+ )
6848
6964
  direct = bool(
6849
6965
  configured_isolation == "adaptive"
6850
6966
  and not bool(getattr(args, "isolated", False))
6851
6967
  and writer_count == 1
6852
6968
  and not other_active
6853
- and not _task_commit_paths(repo)
6969
+ and (not task_paths or direct_changes_owned)
6854
6970
  and current_branch
6855
6971
  and current_branch == target_branch
6856
6972
  )
6973
+ if continue_direct and not direct:
6974
+ raise APError(
6975
+ "Cannot register continued direct work on this checkout; verify target branch, "
6976
+ "owned paths, active writers, and concurrency.isolation"
6977
+ )
6857
6978
  if direct:
6858
6979
  direct_base = _resolve_commit(repo, "HEAD")
6859
6980
  manifest = {
@@ -7114,6 +7235,11 @@ def cmd_task_review(args: argparse.Namespace) -> None:
7114
7235
  reviewer = _text(getattr(args, "reviewer", "")) or _text(os.environ.get("CODEX_THREAD_ID"))
7115
7236
  if not reviewer:
7116
7237
  raise APError("task-review requires --reviewer or CODEX_THREAD_ID.")
7238
+ if bool(manifest.get("review_required")):
7239
+ if not _text(getattr(args, "reviewer", "")):
7240
+ raise APError("Independent review requires an explicit --reviewer identity.")
7241
+ if reviewer == _text(manifest.get("owner")):
7242
+ raise APError("Independent reviewer identity must differ from the task lifecycle owner.")
7117
7243
  manifest["review"] = {
7118
7244
  "verdict": args.verdict,
7119
7245
  "diff_base": _text(manifest.get("base_sha")),
@@ -8068,7 +8194,8 @@ def main(argv: Optional[List[str]] = None) -> int:
8068
8194
  s.add_argument("--planned-path", action="append")
8069
8195
  s.add_argument("--intent")
8070
8196
  s.add_argument("--intent-file")
8071
- s.add_argument("--task-kind", choices=sorted(_TASK_KINDS), default="auto")
8197
+ s.add_argument("--task-kind", choices=sorted(_REQUESTED_TASK_KINDS), default="auto")
8198
+ s.add_argument("--continue-direct", action="store_true")
8072
8199
  s.add_argument("--writers", type=int, default=1)
8073
8200
  s.add_argument("--json", action="store_true")
8074
8201
  s.set_defaults(func=cmd_classify)
@@ -8177,6 +8304,7 @@ def main(argv: Optional[List[str]] = None) -> int:
8177
8304
  s.add_argument("--writers", type=int, default=1)
8178
8305
  s.add_argument("--isolated", action="store_true")
8179
8306
  s.add_argument("--review-required", action="store_true")
8307
+ s.add_argument("--continue-direct", action="store_true")
8180
8308
  s.add_argument(
8181
8309
  "--force-lifecycle",
8182
8310
  action="store_true",
@@ -444,6 +444,55 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
444
444
  self.assertIn("does not need a machine task lifecycle", output)
445
445
  self.assertNotIn("initialization is incomplete", output)
446
446
 
447
+ def test_continue_direct_can_adopt_owned_changes_for_new_review_lifecycle(self) -> None:
448
+ _, repo, remote = self.make_repo("adaptive", require_review=False)
449
+ (repo / "shared.txt").write_text("continued direct\n", encoding="utf-8")
450
+ started = self.ap(
451
+ repo,
452
+ "task-start",
453
+ "DIRECT-CONTINUE",
454
+ "--owned-path",
455
+ "shared.txt",
456
+ "--continue-direct",
457
+ "--review-required",
458
+ )
459
+ self.assertIn("execution_mode=direct", started.stdout)
460
+ status = json.loads(
461
+ self.ap(repo, "task-status", "DIRECT-CONTINUE", "--json").stdout
462
+ )["tasks"][0]
463
+ self.assertEqual("direct", status["execution_mode"])
464
+ missing_reviewer = self.ap(
465
+ repo,
466
+ "task-review",
467
+ "DIRECT-CONTINUE",
468
+ "--verdict",
469
+ "approved",
470
+ "--diff-fingerprint",
471
+ status["current_diff_fingerprint"],
472
+ check=False,
473
+ )
474
+ self.assertNotEqual(0, missing_reviewer.returncode)
475
+ self.assertIn("explicit --reviewer", missing_reviewer.stdout + missing_reviewer.stderr)
476
+ pushed = self.commit_push(repo, "DIRECT-CONTINUE", "DIRECT-CONTINUE: update")
477
+ self.assertIn("execution_mode=direct", pushed.stdout)
478
+ self.assertEqual("continued direct", git_output(remote, "show", "refs/heads/dev:shared.txt"))
479
+
480
+ (repo / "shared.txt").write_text("owned again\n", encoding="utf-8")
481
+ (repo / "unrelated.txt").write_text("unknown\n", encoding="utf-8")
482
+ rejected = self.ap(
483
+ repo,
484
+ "task-start",
485
+ "DIRECT-CONTINUE-BLOCKED",
486
+ "--owned-path",
487
+ "shared.txt",
488
+ "--continue-direct",
489
+ "--review-required",
490
+ check=False,
491
+ )
492
+ self.assertNotEqual(0, rejected.returncode)
493
+ self.assertIn("unrelated.txt", rejected.stdout + rejected.stderr)
494
+ self.assertFalse(self.registry_manifest_path(repo, "DIRECT-CONTINUE-BLOCKED").exists())
495
+
447
496
  def test_schema_one_task_status_fails_closed_with_migration_recovery(self) -> None:
448
497
  _, repo, _ = self.make_repo()
449
498
  self.start_task(repo, "LEGACY-SCHEMA")
@@ -2,6 +2,7 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import argparse
5
+ import json
5
6
  import subprocess
6
7
  import sys
7
8
  import tempfile
@@ -217,6 +218,7 @@ class AutoCodingProfileTests(unittest.TestCase):
217
218
  "result_contract",
218
219
  "stages",
219
220
  "constraints",
221
+ "optional_roles",
220
222
  ]:
221
223
  self.assertIn(field, plan["agent_plan"])
222
224
 
@@ -233,8 +235,12 @@ class AutoCodingProfileTests(unittest.TestCase):
233
235
  self.assertEqual(["src/frontend/LoginPage.tsx"], plan["classification_files"])
234
236
  self.assertTrue(plan["intent_provided"])
235
237
  self.assertEqual(["auth", "release_or_tooling", "ui"], plan["intent_categories"])
238
+ self.assertEqual(["auth", "release_or_tooling"], plan["intent_risk_candidates"])
236
239
  self.assertTrue(plan["needs_browser"])
237
- self.assertEqual(["reviewer"], plan["recommended_agents"])
240
+ self.assertEqual("standard", plan["profile"])
241
+ self.assertFalse(plan["review_required"])
242
+ self.assertEqual([], plan["recommended_agents"])
243
+ self.assertEqual([], plan["optional_agents"])
238
244
  self.assertNotIn("browser_debugger", plan["recommended_agents"])
239
245
  self.assertNotIn("docs_researcher", plan["recommended_agents"])
240
246
  self.assertNotIn("新增登录鉴权页面并发布", str(plan))
@@ -313,6 +319,21 @@ class AutoCodingProfileTests(unittest.TestCase):
313
319
  )
314
320
  self.assertIn("task_lifecycle", terminal["mechanism_plan"]["forbidden"])
315
321
 
322
+ with self.assertRaises(APError):
323
+ self.plan(
324
+ repo,
325
+ cfg,
326
+ planned_paths=["src/payment/service.py"],
327
+ requested_task_kind="terminal_maintenance",
328
+ )
329
+ with self.assertRaises(APError):
330
+ self.plan(
331
+ repo,
332
+ cfg,
333
+ planned_paths=["src/widget.py"],
334
+ requested_task_kind="none",
335
+ )
336
+
316
337
  def test_execution_mode_is_none_direct_isolated_or_parallel(self) -> None:
317
338
  repo, cfg = self.make_repo()
318
339
  self.assertEqual("none", self.plan(repo, cfg)["execution_mode"])
@@ -335,6 +356,84 @@ class AutoCodingProfileTests(unittest.TestCase):
335
356
  self.assertTrue(parallel["review_required"])
336
357
  self.assertIn("fixer", parallel["recommended_agents"])
337
358
  self.assertIn("parallel_fixers", parallel["mechanism_plan"]["required"])
359
+ self.assertEqual("orchestrated-subagents", parallel["agent_plan"]["strategy"])
360
+
361
+ def test_continue_direct_accepts_only_declared_current_task_dirt(self) -> None:
362
+ repo, cfg = self.make_repo()
363
+ target = repo / "src" / "widget.py"
364
+ target.parent.mkdir(parents=True, exist_ok=True)
365
+ target.write_text("task change\n", encoding="utf-8")
366
+
367
+ default = self.plan(repo, cfg, planned_paths=["src/widget.py"])
368
+ self.assertEqual("isolated", default["execution_mode"])
369
+ continued = self.plan(
370
+ repo,
371
+ cfg,
372
+ planned_paths=["src/widget.py"],
373
+ continue_direct=True,
374
+ )
375
+ self.assertEqual("direct", continued["execution_mode"])
376
+ self.assertTrue(continued["continued_direct"])
377
+ self.assertEqual([], continued["dirty_outside_plan"])
378
+
379
+ (repo / "unrelated.txt").write_text("other writer\n", encoding="utf-8")
380
+ blocked = self.plan(
381
+ repo,
382
+ cfg,
383
+ planned_paths=["src/widget.py"],
384
+ continue_direct=True,
385
+ )
386
+ self.assertEqual("isolated", blocked["execution_mode"])
387
+ self.assertEqual(["unrelated.txt"], blocked["dirty_outside_plan"])
388
+
389
+ def test_risk_intent_is_candidate_while_paths_and_rules_control_escalation(self) -> None:
390
+ repo, cfg = self.make_repo()
391
+ ui = self.plan(
392
+ repo,
393
+ cfg,
394
+ planned_paths=["frontend/src/LoginPage.tsx"],
395
+ intent="修复登录跳转问题",
396
+ )
397
+ self.assertEqual("standard", ui["profile"])
398
+ self.assertFalse(ui["review_required"])
399
+ self.assertEqual(["auth"], ui["intent_risk_candidates"])
400
+ self.assertEqual(["browser_debugger"], ui["optional_agents"])
401
+
402
+ backend = self.plan(repo, cfg, planned_paths=["backend/auth/service.py"])
403
+ self.assertEqual("high-risk", backend["profile"])
404
+ self.assertTrue(backend["review_required"])
405
+ self.assertEqual(["explorer"], backend["optional_agents"])
406
+
407
+ cfg["risk"] = {
408
+ "rules": [
409
+ {
410
+ "name": "sensitive-login-ui",
411
+ "paths": ["frontend/src/LoginPage.tsx"],
412
+ "profile": "high-risk",
413
+ }
414
+ ]
415
+ }
416
+ configured = self.plan(repo, cfg, planned_paths=["frontend/src/LoginPage.tsx"])
417
+ self.assertEqual("high-risk", configured["profile"])
418
+
419
+ order = self.plan(repo, cfg, planned_paths=["backend/orders/sort_order.py"])
420
+ self.assertNotIn("payment", order["categories"])
421
+
422
+ def test_generated_agent_strategies_match_contract_schema(self) -> None:
423
+ schema = json.loads(
424
+ (REPO_ROOT / "src" / "auto-coding-skill" / "data" / "contracts" / "orchestration-v1.schema.json")
425
+ .read_text(encoding="utf-8")
426
+ )
427
+ allowed = set(schema["$defs"]["agentPlan"]["properties"]["strategy"]["enum"])
428
+ repo, cfg = self.make_repo()
429
+ for kwargs in [
430
+ {"planned_paths": ["src/widget.py"]},
431
+ {"planned_paths": ["backend/auth/service.py"]},
432
+ {"planned_paths": ["src/widget.py"], "parallel_writers": 2},
433
+ ]:
434
+ with self.subTest(kwargs=kwargs):
435
+ plan = self.plan(repo, cfg, **kwargs)
436
+ self.assertIn(plan["agent_plan"]["strategy"], allowed)
338
437
 
339
438
  def test_validation_routes_collect_all_commands_and_reject_unmapped_code(self) -> None:
340
439
  repo, cfg = self.make_repo()
@@ -486,7 +486,7 @@ function testBridgeIsGeneric() {
486
486
  run("python3", [assetAp, "--repo", repo, "install", "--bridges"]);
487
487
  assert(exists(path.join(repo, "AGENTS.md")), "generic bridge should be created");
488
488
  const bridge = fs.readFileSync(path.join(repo, "AGENTS.md"), "utf8");
489
- assert(bridge.includes("Every writing agent owns a distinct task ID, worktree"), "bridge should expose writer isolation");
489
+ assert(bridge.includes("Every delegated fixer or parallel writer owns a task ID/worktree"), "bridge should expose delegated-writer isolation");
490
490
  assert(bridge.includes("integrates in dependency order"), "bridge should expose dependency ordering");
491
491
  for (const filename of [`CO${"DEX.md"}`, `CLA${"UDE.md"}`]) {
492
492
  assert(!exists(path.join(repo, filename)), "client-named bridge should not be created");
@@ -733,7 +733,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
733
733
 
734
734
  const engineering = path.join(repo, "docs", "ENGINEERING.md");
735
735
  const initial = fs.readFileSync(engineering, "utf8");
736
- const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.2 -->/;
736
+ const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.3 -->/;
737
737
  const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
738
738
  assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
739
739
  assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
@@ -752,7 +752,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
752
752
  const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
753
753
  const dryResult = JSON.parse(dryRun.stdout).results[0];
754
754
  assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
755
- assert(dryResult.managedWorkflow.version === "4.1.2", "dry-run should expose the target workflow version");
755
+ assert(dryResult.managedWorkflow.version === "4.1.3", "dry-run should expose the target workflow version");
756
756
  assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
757
757
  assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
758
758
 
@@ -762,14 +762,14 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
762
762
  const updatedEnd = updated.indexOf(endMarker) + endMarker.length;
763
763
  assert(updated.slice(0, updatedStart) === outsideBefore, "sync must preserve frontmatter and content before the managed block byte-for-byte");
764
764
  assert(updated.slice(updatedEnd) === outsideAfter, "sync must preserve content after the managed block byte-for-byte");
765
- assert(updated.includes("version=4.1.2"), "sync should install the current managed workflow version");
765
+ assert(updated.includes("version=4.1.3"), "sync should install the current managed workflow version");
766
766
  assert(updated.includes("The frontmatter contract is:"), "sync should refresh stale managed workflow content");
767
767
 
768
768
  fillRequiredAccess(repo);
769
769
  const status = run("node", [cli, "status", "--projects", repo, "--json"]);
770
770
  const statusResult = JSON.parse(status.stdout).results[0];
771
771
  assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
772
- assert(statusResult.managedWorkflow.version === "4.1.2", "status should expose the installed managed workflow version");
772
+ assert(statusResult.managedWorkflow.version === "4.1.3", "status should expose the installed managed workflow version");
773
773
 
774
774
  const beforeSecondSync = fs.readFileSync(engineering, "utf8");
775
775
  const second = run("node", [cli, "sync", "--projects", repo, "--json"]);
@@ -797,7 +797,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
797
797
  assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
798
798
  run("node", [cli, "sync", "--projects", repo]);
799
799
  const migrated = fs.readFileSync(engineering, "utf8");
800
- assert(migrated.includes("version=4.1.2"), "legacy migration should insert the current managed workflow");
800
+ assert(migrated.includes("version=4.1.3"), "legacy migration should insert the current managed workflow");
801
801
  assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
802
802
  const migratedStart = migrated.indexOf("<!-- auto-coding-skill:managed-workflow:start");
803
803
  const migratedEnd = migrated.indexOf(endMarker) + endMarker.length;
@@ -901,7 +901,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
901
901
  run("node", [cli, "sync", "--projects", repo]);
902
902
  const agents = path.join(repo, "AGENTS.md");
903
903
  const initial = fs.readFileSync(agents, "utf8");
904
- assert(initial.includes("managed-agents:start version=4.1.2"), "new projects should receive the versioned root AGENTS block");
904
+ assert(initial.includes("managed-agents:start version=4.1.3"), "new projects should receive the versioned root AGENTS block");
905
905
 
906
906
  const custom = [
907
907
  "# Project rules",
@@ -920,12 +920,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
920
920
 
921
921
  run("node", [cli, "sync", "--projects", repo]);
922
922
  const migrated = fs.readFileSync(agents, "utf8");
923
- assert(migrated.includes("managed-agents:start version=4.1.2"), "AGENTS migration should install the current managed block");
923
+ assert(migrated.includes("managed-agents:start version=4.1.3"), "AGENTS migration should install the current managed block");
924
924
  assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
925
925
  assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
926
926
  const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
927
927
  assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
928
- const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.1.2.md");
928
+ const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.1.3.md");
929
929
  assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
930
930
  const stable = fs.readFileSync(agents);
931
931
  run("node", [cli, "sync", "--projects", repo]);
@@ -984,7 +984,7 @@ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow()
984
984
  const migrationResult = JSON.parse(migration.stdout).results[0];
985
985
  assert(migrationResult.managedWorkflow.state === "stale", "known duplicate sections should use controlled migration");
986
986
  assert(migrationResult.managedWorkflow.migrations.includes("engineering-section-delivery-flow"), "known section migration should be explicit");
987
- assert(migrationResult.actions.some(item => item.action === "would-archive" && item.path.includes("ENGINEERING.pre-4.1.2")), "controlled section cleanup should archive the previous ENGINEERING file");
987
+ assert(migrationResult.actions.some(item => item.action === "would-archive" && item.path.includes("ENGINEERING.pre-4.1.3")), "controlled section cleanup should archive the previous ENGINEERING file");
988
988
  run("node", [cli, "sync", "--projects", repo]);
989
989
  assert(!fs.readFileSync(engineering, "utf8").includes("Known obsolete workflow"), "known duplicate workflow section should be removed");
990
990
 
@@ -996,14 +996,14 @@ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow()
996
996
  }
997
997
 
998
998
  function testReleaseVersionMarkersStayInSync() {
999
- const expected = "4.1.2";
999
+ const expected = "4.1.3";
1000
1000
  const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
1001
1001
  const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
1002
1002
  const policy = JSON.parse(fs.readFileSync(
1003
1003
  path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
1004
1004
  "utf8",
1005
1005
  ));
1006
- assert(pkg.version === expected, "package version must match the 4.1.2 release");
1006
+ assert(pkg.version === expected, "package version must match the 4.1.3 release");
1007
1007
  assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
1008
1008
  assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
1009
1009
  for (const rel of [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elvis1513/auto-coding-skill",
3
- "version": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "CLI installer for a delivery-first .agents workflow with adaptive Git isolation, routed changed-scope validation, risk-based review, push completion, and safe cleanup.",
5
5
  "type": "module",
6
6
  "bin": {