kiro-spec-engine 1.47.4 → 1.47.6

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/CHANGELOG.md CHANGED
@@ -8,6 +8,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
  ### Added
11
+ - **Scene ontology impact/path analysis commands**: Added `kse scene ontology impact` (reverse dependency blast-radius analysis with `--relation` and `--max-depth`) and `kse scene ontology path` (shortest relation path between refs with optional `--undirected`) to improve ontology-driven change planning and explainability.
12
+ - **Close-loop quantitative DoD gates**: Added `--dod-max-risk-level`, `--dod-kpi-min-completion-rate`, `--dod-max-success-rate-drop`, and `--dod-baseline-window` so autonomous closure can enforce explicit risk/KPI/baseline thresholds beyond binary checks.
13
+ - **Close-loop conflict/ontology execution planning**: Added lease-conflict scheduling governance and scene ontology scheduling guidance with opt-out controls (`--no-conflict-governance`, `--no-ontology-guidance`), and surfaced planning telemetry in `portfolio.execution_plan` plus agent sync plan output.
14
+ - **Close-loop strategy memory feedback loop**: Added persisted strategy memory (`.kiro/auto/close-loop-strategy-memory.json`) to reuse prior goal-level policy hints and track-level feedback bias during decomposition, with run telemetry under `strategy_memory`.
15
+ - **Unified autonomous observability snapshot**: Added `kse auto observability snapshot` to aggregate close-loop, batch, controller, governance, and KPI-trend telemetry into one machine-readable payload.
16
+ - **Agent-facing spec JSON interfaces**: Added `kse auto spec status <spec-name> --json` and `kse auto spec instructions <spec-name> --json` for structured status/instruction retrieval in master-sub agent workflows.
17
+ - **Autonomous archive schema compatibility tooling**: Added `kse auto schema check` and `kse auto schema migrate` (dry-run by default, `--apply` to persist) to audit and migrate `schema_version` across autonomous archives.
18
+ - **Governance resumed-session filtering and ratio telemetry**: `kse auto governance session list|stats` now support `--resume-only`, with new resumed/fresh counters and resume lineage composition telemetry (`resumed_rate_percent`, `resumed_from_counts`) for resumed-chain observability.
19
+ - **Governance close-loop post-run retention hook**: Added `--governance-session-keep` and `--governance-session-older-than-days` to `kse auto governance close-loop` for automatic governance session archive pruning after each run, with current session protection and telemetry in `governance_session_prune`.
20
+ - **Governance resume drift guardrails**: `kse auto governance close-loop --governance-resume` now reuses persisted target/advisory policy defaults by default and blocks explicit policy drift unless `--governance-resume-allow-drift` is set, reducing accidental resume misconfiguration.
21
+ - **Governance session maintenance commands**: Added `kse auto governance session list|stats|prune` for persisted governance close-loop session observability and retention management, including status/day filters, convergence/risk telemetry, and archive cleanup controls (`--keep`, `--older-than-days`, `--dry-run`).
22
+ - **Governance close-loop session persistence and resume**: Added default governance loop session archiving (`.kiro/auto/governance-close-loop-sessions`) with controls `--governance-session-id`, `--no-governance-session`, and `--governance-resume <session|latest|file>` so interrupted governance rounds can be resumed without restarting from round 1.
23
+ - **Governance close-loop advisory execution**: Added optional advisory action execution to `kse auto governance close-loop` via `--execute-advisory`, including bounded controls `--advisory-recover-max-rounds` and `--advisory-controller-max-cycles`, with per-round advisory telemetry (`advisory_actions`, advisory action counts) and top-level advisory policy/summary output. Advisory source selection is now autonomous (latest recoverable batch summary / latest controller session with pending goals) and emits `skipped` instead of hard-failing when no actionable advisory source exists.
24
+ - **Governance close-loop rounds command**: Added `kse auto governance close-loop` to run bounded governance-maintenance rounds toward a target risk (`--target-risk`) with convergence telemetry (`rounds`, `initial_assessment`, `final_assessment`, `stop_reason`, `converged`) and non-mutating planning support (`--plan-only`, `--dry-run`).
25
+ - **Governance maintenance close-loop command**: Added `kse auto governance maintain` to combine governance assessment and optional maintenance execution (`--apply`) across session/batch/controller archives and recovery memory, with policy knobs (`--session-keep`, `--batch-session-keep`, `--controller-session-keep`, `--recovery-memory-older-than-days`), dry-run support, and before/after telemetry.
26
+ - **Cross-archive governance stats command**: Added `kse auto governance stats` with optional `--days` / `--status` filters to unify session/batch-session/controller-session telemetry and recovery-memory state into one governance snapshot (`totals`, `throughput`, `health` risk diagnostics, `top_master_specs`, and per-archive detail payloads).
27
+ - **Session and batch session stats commands**: Added `kse auto session stats` and `kse auto batch-session stats` with optional `--days` / `--status` filters and JSON telemetry (completion/failure rates, volume aggregates, composition breakdowns, latest-session snapshots) for autonomous archive observability.
28
+ - **Controller session stats command**: Added `kse auto controller-session stats` with optional `--days` / `--status` filters and JSON telemetry (`status_counts`, `queue_format_counts`, completion/failure rates, goal-volume sums, and latest-session snapshot) for controller archive observability.
11
29
  - **Session list status filtering + composition telemetry**: `kse auto session list`, `kse auto batch-session list`, and `kse auto controller-session list` now support `--status <csv>` (case-insensitive) and emit `status_filter` / `status_counts` in JSON output for faster archive triage.
12
30
  - **KPI mode composition telemetry**: `kse auto kpi trend` JSON output now includes `mode_breakdown` (batch/program/recover/controller/other) to expose mixed-run trend composition.
13
31
  - **Spec protection source expansion**: `spec-session prune` now protects specs referenced by recent/incomplete controller sessions (via nested batch summary references), reducing accidental cleanup during controller-driven autonomous runs.
package/README.md CHANGED
@@ -537,6 +537,11 @@ kse auto close-loop-controller .kiro/auto/program-queue.lines --wait-on-empty --
537
537
  kse auto close-loop-controller --controller-resume latest --json # Resume autonomous controller from latest persisted checkpoint
538
538
  kse auto controller-session list --limit 50 --json # Inspect persisted close-loop-controller summary sessions
539
539
  kse auto controller-session prune --keep 20 --older-than-days 14 --dry-run --json # Prune old controller summaries by retention policy
540
+ kse auto observability snapshot --days 14 --json # Unified autonomous observability snapshot (sessions + governance + trend)
541
+ kse auto spec status 121-00-master --json # Agent-facing structured spec status interface
542
+ kse auto spec instructions 121-02-sub-track --json # Agent-facing execution instructions for one spec
543
+ kse auto schema check --json # Check autonomous archive schema compatibility
544
+ kse auto schema migrate --apply --json # Backfill/migrate schema_version for autonomous archives
540
545
 
541
546
  # Spec workflow (recommended)
542
547
  kse spec bootstrap --name <spec> --non-interactive # Generate requirements/design/tasks draft
@@ -609,6 +614,8 @@ kse scene contribute --package <path> # One-stop validate → lint →
609
614
  # Scene ontology (NEW in v1.42.0)
610
615
  kse scene ontology show --package <path> # Show ontology graph
611
616
  kse scene ontology deps --ref <ref> # Query dependency chain
617
+ kse scene ontology impact --ref <ref> # Analyze reverse impact radius
618
+ kse scene ontology path --from <ref> --to <ref> # Query shortest ontology relation path
612
619
  kse scene ontology validate --package <path> # Validate graph consistency
613
620
  kse scene ontology actions --ref <ref> # Show action abstraction
614
621
  kse scene ontology lineage --ref <ref> # Show data lineage
package/README.zh.md CHANGED
@@ -454,6 +454,11 @@ kse auto close-loop-controller .kiro/auto/program-queue.lines --wait-on-empty --
454
454
  kse auto close-loop-controller --controller-resume latest --json # 从最近一次 controller 检查点恢复自治推进
455
455
  kse auto controller-session list --limit 50 --json # 查看持久化 close-loop-controller 摘要会话
456
456
  kse auto controller-session prune --keep 20 --older-than-days 14 --dry-run --json # 按保留策略清理旧 controller 摘要
457
+ kse auto observability snapshot --days 14 --json # 统一自治可观测快照(会话 + 治理 + 趋势)
458
+ kse auto spec status 121-00-master --json # 面向 Agent 的结构化 Spec 状态接口
459
+ kse auto spec instructions 121-02-sub-track --json # 面向 Agent 的 Spec 执行指令接口
460
+ kse auto schema check --json # 检查自治归档 schema 兼容性
461
+ kse auto schema migrate --apply --json # 回填/迁移自治归档 schema_version
457
462
 
458
463
  # Spec 工作流(推荐)
459
464
  kse spec bootstrap --name <spec> --non-interactive # 生成 requirements/design/tasks 初稿
@@ -511,6 +516,8 @@ kse scene contribute --package <path> # 一站式验证 → lint →
511
516
  # 场景 Ontology (v1.42.0 新增)
512
517
  kse scene ontology show --package <path> # 显示 Ontology 图
513
518
  kse scene ontology deps --ref <ref> # 查询依赖链
519
+ kse scene ontology impact --ref <ref> # 分析反向影响面
520
+ kse scene ontology path --from <ref> --to <ref> # 查询最短关系路径
514
521
  kse scene ontology validate --package <path> # 验证图一致性
515
522
  kse scene ontology actions --ref <ref> # 显示 Action Abstraction
516
523
  kse scene ontology lineage --ref <ref> # 显示数据血缘
@@ -187,8 +187,10 @@ Session persistence and resume:
187
187
  - `--session-keep <n>`: automatically prune old snapshots and keep newest `n` after each close-loop run
188
188
  - `--session-older-than-days <n>`: when pruning, only delete snapshots older than `n` days
189
189
  - `kse auto session list [--limit <n>] [--status <csv>]`: inspect persisted sessions (`--status` supports comma-separated, case-insensitive filters)
190
+ - `kse auto session stats [--days <n>] [--status <csv>] [--json]`: aggregate session status/topology telemetry in an optional recent-day window
190
191
  - `kse auto session prune --keep <n> [--older-than-days <n>]`: enforce retention policy
191
- - JSON output includes `status_filter` and `status_counts` for filtered session distributions.
192
+ - List JSON output includes `status_filter` and `status_counts` for filtered session distributions.
193
+ - Stats JSON output includes `criteria`, completion/failure rates, `sub_spec_count_sum`, `master_spec_counts`, and `latest_sessions`.
192
194
 
193
195
  Spec directory maintenance:
194
196
  - `kse auto spec-session list [--limit <n>] [--json]`: inspect spec directory inventory under `.kiro/specs`
@@ -203,8 +205,10 @@ Batch summary session persistence and maintenance:
203
205
  - `--batch-session-older-than-days <n>`: when pruning, only delete summaries older than `n` days
204
206
  - `--no-batch-session`: disable batch summary archive for the current run
205
207
  - `kse auto batch-session list [--limit <n>] [--status <csv>]`: inspect persisted batch summary sessions (`--status` supports comma-separated, case-insensitive filters)
208
+ - `kse auto batch-session stats [--days <n>] [--status <csv>] [--json]`: aggregate batch session status/goal-volume telemetry in an optional recent-day window
206
209
  - `kse auto batch-session prune --keep <n> [--older-than-days <n>]`: enforce batch summary retention policy
207
- - JSON output includes `status_filter` and `status_counts` for filtered status composition.
210
+ - List JSON output includes `status_filter` and `status_counts` for filtered status composition.
211
+ - Stats JSON output includes `criteria`, completion/failure rates, goal-volume sums, processed ratio, and `latest_sessions`.
208
212
 
209
213
  Controller summary session persistence and maintenance:
210
214
  - Default controller summary archive: `.kiro/auto/close-loop-controller-sessions/*.json`
@@ -213,8 +217,28 @@ Controller summary session persistence and maintenance:
213
217
  - `--controller-session-older-than-days <n>`: when pruning, only delete summaries older than `n` days
214
218
  - `--no-controller-session`: disable controller summary archive for the current run
215
219
  - `kse auto controller-session list [--limit <n>] [--status <csv>]`: inspect persisted controller summary sessions (`--status` supports comma-separated, case-insensitive filters)
220
+ - `kse auto controller-session stats [--days <n>] [--status <csv>] [--json]`: aggregate controller session status/throughput telemetry in an optional recent-day window
216
221
  - `kse auto controller-session prune --keep <n> [--older-than-days <n>]`: enforce controller summary retention policy
217
- - JSON output includes `status_filter` and `status_counts` for filtered status composition.
222
+ - List JSON output includes `status_filter` and `status_counts` for filtered status composition.
223
+ - Stats JSON output includes `criteria`, `status_counts`, `queue_format_counts`, completion/failure rates, goal-volume sums, and `latest_sessions`.
224
+
225
+ Cross-archive governance snapshot:
226
+ - `kse auto governance stats [--days <n>] [--status <csv>] [--json]`: aggregate a unified governance cockpit over session/batch/controller archives plus recovery memory state.
227
+ - JSON output includes `totals`, `throughput`, `top_master_specs`, per-archive `archives.*` stats payloads, and `health` diagnostics (`risk_level`, `concerns`, `recommendations`) for one-command close-loop governance checks.
228
+ - `kse auto governance maintain [--days <n>] [--status <csv>] [--session-keep <n>] [--batch-session-keep <n>] [--controller-session-keep <n>] [--recovery-memory-older-than-days <n>] [--apply] [--dry-run] [--json]`: close-loop governance maintenance entrypoint.
229
+ - Default is plan-only (`assessment` + `plan`).
230
+ - `--apply` executes maintenance actions for archive hygiene (session/batch/controller pruning + recovery-memory stale-entry pruning).
231
+ - `--dry-run` can be combined with `--apply` to validate maintenance impact before deletion.
232
+ - `kse auto governance close-loop [--max-rounds <n>] [--target-risk <low|medium|high>] [--governance-resume <session|latest|file>] [--governance-resume-allow-drift] [--governance-session-id <id>] [--no-governance-session] [--governance-session-keep <n>] [--governance-session-older-than-days <n>] [--execute-advisory] [--advisory-recover-max-rounds <n>] [--advisory-controller-max-cycles <n>] [--plan-only] [--dry-run] [--json]`: governance round-loop runner.
233
+ - Orchestrates repeated `governance maintain` rounds until target risk or stop condition is reached.
234
+ - Governance close-loop sessions persist by default at `.kiro/auto/governance-close-loop-sessions`; use `--governance-resume` to continue interrupted governance loops.
235
+ - Resume defaults inherit persisted governance policy (`target_risk`, `execute_advisory`, `advisory_policy`) to avoid accidental configuration drift; explicit drift is blocked unless `--governance-resume-allow-drift` is set.
236
+ - `--governance-session-keep` enables automatic post-run governance session pruning (optional age window via `--governance-session-older-than-days`) while preserving the current run session file.
237
+ - `--execute-advisory` enables automatic advisory action execution when detected (`recover-latest`, `controller-resume-latest`), with autonomous source selection (latest recoverable summary / latest pending controller session) and `skipped` telemetry when no actionable source exists.
238
+ - Emits round history (`risk_before`/`risk_after`, planned/applicable/applied/failed actions), advisory telemetry (`advisory_*` fields), plus initial/final assessments for auditable autonomous governance convergence.
239
+ - `kse auto governance session list [--limit <n>] [--status <csv>] [--resume-only] [--json]`: inspect persisted governance close-loop session archive (optional resumed-chain filter).
240
+ - `kse auto governance session stats [--days <n>] [--status <csv>] [--resume-only] [--json]`: aggregate governance session completion/failure/convergence/risk telemetry with resumed-session ratio/source breakdown.
241
+ - `kse auto governance session prune [--keep <n>] [--older-than-days <n>] [--dry-run] [--json]`: enforce governance session retention policy.
218
242
 
219
243
  Recovery memory maintenance:
220
244
  - Default recovery memory file: `.kiro/auto/close-loop-recovery-memory.json`
@@ -425,6 +425,10 @@ kse auto session list
425
425
  kse auto session list --status completed,partial-failed
426
426
  kse auto session list --limit 50 --json
427
427
 
428
+ # Aggregate close-loop session telemetry
429
+ kse auto session stats
430
+ kse auto session stats --days 14 --status completed --json
431
+
428
432
  # Prune old close-loop sessions
429
433
  kse auto session prune --keep 50
430
434
  kse auto session prune --keep 20 --older-than-days 14 --dry-run
@@ -443,6 +447,10 @@ kse auto batch-session list
443
447
  kse auto batch-session list --status failed
444
448
  kse auto batch-session list --limit 50 --json
445
449
 
450
+ # Aggregate close-loop-batch summary telemetry
451
+ kse auto batch-session stats
452
+ kse auto batch-session stats --days 14 --status failed --json
453
+
446
454
  # Prune old close-loop-batch summary sessions
447
455
  kse auto batch-session prune --keep 50
448
456
  kse auto batch-session prune --keep 20 --older-than-days 14 --dry-run
@@ -452,10 +460,31 @@ kse auto controller-session list
452
460
  kse auto controller-session list --status partial-failed
453
461
  kse auto controller-session list --limit 50 --json
454
462
 
463
+ # Aggregate close-loop-controller summary session telemetry
464
+ kse auto controller-session stats
465
+ kse auto controller-session stats --days 14 --status partial-failed --json
466
+
455
467
  # Prune old close-loop-controller summary sessions
456
468
  kse auto controller-session prune --keep 50
457
469
  kse auto controller-session prune --keep 20 --older-than-days 14 --dry-run
458
470
 
471
+ # Aggregate cross-archive autonomous governance telemetry
472
+ kse auto governance stats
473
+ kse auto governance stats --days 14 --status completed,partial-failed --json
474
+ kse auto governance maintain --session-keep 50 --batch-session-keep 50 --controller-session-keep 50 --json
475
+ kse auto governance maintain --apply --session-keep 20 --batch-session-keep 20 --controller-session-keep 20 --recovery-memory-older-than-days 90 --json
476
+ kse auto governance close-loop --plan-only --max-rounds 3 --target-risk low --json
477
+ kse auto governance close-loop --max-rounds 3 --target-risk low --session-keep 20 --batch-session-keep 20 --controller-session-keep 20 --json
478
+ kse auto governance close-loop --max-rounds 3 --governance-session-keep 50 --governance-session-older-than-days 30 --json
479
+ kse auto governance close-loop --max-rounds 3 --target-risk low --execute-advisory --advisory-recover-max-rounds 3 --advisory-controller-max-cycles 20 --dry-run --json
480
+ kse auto governance close-loop --governance-resume latest --max-rounds 5 --json
481
+ kse auto governance close-loop --governance-resume latest --target-risk high --governance-resume-allow-drift --json
482
+ kse auto governance session list --limit 20 --status completed,failed --json
483
+ kse auto governance session list --resume-only --json
484
+ kse auto governance session stats --days 30 --json
485
+ kse auto governance session stats --resume-only --json
486
+ kse auto governance session prune --keep 50 --older-than-days 30 --dry-run --json
487
+
459
488
  # Recovery memory maintenance
460
489
  kse auto recovery-memory show --json
461
490
  kse auto recovery-memory scopes --json
@@ -465,11 +494,29 @@ kse auto recovery-memory clear --json
465
494
  # Autonomous KPI trend (weekly/daily buckets + CSV export)
466
495
  kse auto kpi trend --weeks 12 --period week --mode all --json
467
496
  kse auto kpi trend --weeks 8 --period day --mode program --csv --out ./auto-kpi-trend.csv
497
+
498
+ # Unified observability snapshot (sessions + governance + KPI trend)
499
+ kse auto observability snapshot --days 14 --status completed,failed --json
500
+ kse auto observability snapshot --out .kiro/reports/auto-observability.json --json
501
+
502
+ # Agent-facing spec interfaces
503
+ kse auto spec status 121-00-master --json
504
+ kse auto spec instructions 121-02-sub-track --json
505
+
506
+ # Autonomous archive schema compatibility
507
+ kse auto schema check --json
508
+ kse auto schema migrate --json # dry-run by default
509
+ kse auto schema migrate --apply --json # apply schema_version migration
510
+ kse auto schema migrate --only close-loop-session,batch-session --apply --json
468
511
  ```
469
512
 
470
513
  DoD-related options:
471
514
  - `--dod-tests <command>`: run a final shell command as a completion gate
472
515
  - `--dod-tests-timeout <ms>`: timeout for `--dod-tests` (default `600000`)
516
+ - `--dod-max-risk-level <low|medium|high>`: fail DoD when derived run risk is above threshold
517
+ - `--dod-kpi-min-completion-rate <n>`: minimum close-loop completion rate percent (`0-100`)
518
+ - `--dod-max-success-rate-drop <n>`: max allowed completion-rate drop vs recent baseline (`0-100`)
519
+ - `--dod-baseline-window <n>`: number of recent sessions used for baseline comparison (`1-50`, default `5`)
473
520
  - `--dod-tasks-closed`: require no unchecked `- [ ]` items in generated `tasks.md`
474
521
  - `--no-dod-docs`: skip doc completeness gate
475
522
  - `--no-dod-collab`: skip collaboration completion gate
@@ -486,6 +533,8 @@ DoD-related options:
486
533
  - `--replan-attempts <n>`: max automatic replan cycles after failed orchestration (`0-5`, default `1`)
487
534
  - `--replan-no-progress-window <n>`: stop replan when no progress repeats for `n` failed cycles (`1-10`, default `3`)
488
535
  - `--no-replan`: disable automatic replan cycle
536
+ - `--no-conflict-governance`: disable lease-conflict prediction and scheduling guard
537
+ - `--no-ontology-guidance`: disable scene ontology `agent_hints` scheduling guidance
489
538
 
490
539
  Close-loop batch (`kse auto close-loop-batch <goals-file>`) options:
491
540
  - supports shared close-loop execution options (for example: `--subs`, `--max-parallel`, `--dod*`, `--replan*`, `--dry-run`, `--json`)
@@ -621,8 +670,10 @@ Close-loop recovery (`kse auto close-loop-recover [summary]`) options:
621
670
 
622
671
  Close-loop session maintenance:
623
672
  - `kse auto session list [--limit <n>] [--status <csv>] [--json]`: list persisted close-loop sessions (`--status` supports comma-separated, case-insensitive filters)
673
+ - `kse auto session stats [--days <n>] [--status <csv>] [--json]`: aggregate persisted close-loop session telemetry within an optional recent-day window
624
674
  - `kse auto session prune [--keep <n>] [--older-than-days <n>] [--dry-run] [--json]`: prune old session snapshots
625
- - JSON output includes `status_filter` and `status_counts` over filtered sessions.
675
+ - List JSON output includes `status_filter` and `status_counts` over filtered sessions.
676
+ - Stats JSON output includes `criteria`, completion/failure rates, `sub_spec_count_sum`, `master_spec_counts`, and `latest_sessions`.
626
677
 
627
678
  Spec directory maintenance:
628
679
  - `kse auto spec-session list [--limit <n>] [--json]`: list persisted spec directories under `.kiro/specs`
@@ -633,13 +684,34 @@ Spec directory maintenance:
633
684
 
634
685
  Close-loop batch session maintenance:
635
686
  - `kse auto batch-session list [--limit <n>] [--status <csv>] [--json]`: list persisted close-loop-batch summary sessions (`--status` supports comma-separated, case-insensitive filters)
687
+ - `kse auto batch-session stats [--days <n>] [--status <csv>] [--json]`: aggregate persisted close-loop-batch summary telemetry within an optional recent-day window
636
688
  - `kse auto batch-session prune [--keep <n>] [--older-than-days <n>] [--dry-run] [--json]`: prune old persisted batch summaries
637
- - JSON output includes `status_filter` and `status_counts` over filtered sessions.
689
+ - List JSON output includes `status_filter` and `status_counts` over filtered sessions.
690
+ - Stats JSON output includes `criteria`, completion/failure rates, goal-volume sums, processed ratio, and `latest_sessions`.
638
691
 
639
692
  Close-loop controller session maintenance:
640
693
  - `kse auto controller-session list [--limit <n>] [--status <csv>] [--json]`: list persisted close-loop-controller summary sessions (`--status` supports comma-separated, case-insensitive filters)
694
+ - `kse auto controller-session stats [--days <n>] [--status <csv>] [--json]`: aggregate persisted close-loop-controller status/throughput telemetry within an optional recent-day window
641
695
  - `kse auto controller-session prune [--keep <n>] [--older-than-days <n>] [--dry-run] [--json]`: prune old persisted controller summaries
642
- - JSON output includes `status_filter` and `status_counts` over filtered sessions.
696
+ - List JSON output includes `status_filter` and `status_counts` over filtered sessions.
697
+ - Stats JSON output includes `criteria`, `status_counts`, `queue_format_counts`, completion/failure rates, goal-volume sums, and `latest_sessions`.
698
+
699
+ Cross-archive autonomous governance maintenance:
700
+ - `kse auto governance stats [--days <n>] [--status <csv>] [--json]`: aggregate a unified governance snapshot from session/batch-session/controller-session archives plus recovery memory state.
701
+ - JSON output includes `totals`, `throughput`, `health` (`risk_level`, `concerns`, `recommendations`), `top_master_specs`, `recovery_memory`, and full per-archive stats under `archives`.
702
+ - `kse auto governance maintain [--days <n>] [--status <csv>] [--session-keep <n>] [--batch-session-keep <n>] [--controller-session-keep <n>] [--recovery-memory-older-than-days <n>] [--apply] [--dry-run] [--json]`: run governance-maintenance planning and optional execution in one command.
703
+ - Plan-only mode is default; add `--apply` to execute maintenance actions (`session prune`, `batch-session prune`, `controller-session prune`, `recovery-memory prune`).
704
+ - JSON output includes `assessment` (pre-maintenance governance snapshot), `plan`, `executed_actions`, `summary`, and `after_assessment` (only when `--apply` without `--dry-run`).
705
+ - `kse auto governance close-loop [--days <n>] [--status <csv>] [--session-keep <n>] [--batch-session-keep <n>] [--controller-session-keep <n>] [--recovery-memory-older-than-days <n>] [--max-rounds <n>] [--target-risk <low|medium|high>] [--governance-resume <session|latest|file>] [--governance-resume-allow-drift] [--governance-session-id <id>] [--no-governance-session] [--governance-session-keep <n>] [--governance-session-older-than-days <n>] [--execute-advisory] [--advisory-recover-max-rounds <n>] [--advisory-controller-max-cycles <n>] [--plan-only] [--dry-run] [--json]`: run governance rounds until stop condition (target risk reached, no actionable maintenance/advisory, non-mutating mode, maintenance/advisory failures, or max rounds).
706
+ - `--plan-only` runs a single non-mutating planning round.
707
+ - Governance close-loop sessions are persisted by default at `.kiro/auto/governance-close-loop-sessions/*.json`; use `--governance-resume` to continue interrupted governance loops.
708
+ - On resume, KSE reuses persisted policy defaults (`target_risk`, `execute_advisory`, `advisory_policy`) unless explicitly overridden. Explicit policy drift is blocked by default; add `--governance-resume-allow-drift` to force override.
709
+ - `--governance-session-keep` (with optional `--governance-session-older-than-days`) enables post-run governance session retention pruning while protecting the current session snapshot.
710
+ - `--execute-advisory` enables automatic advisory action execution (`recover-latest`, `controller-resume-latest`) when governance assessment detects failed sessions or controller pending goals; KSE auto-selects the latest actionable advisory source and reports `skipped` (not `failed`) when no actionable source exists.
711
+ - JSON output includes round-by-round risk/action telemetry (`rounds`), advisory telemetry (`execute_advisory`, `advisory_policy`, `advisory_summary`, `rounds[*].advisory_actions`), plus `initial_assessment`, `final_assessment`, and convergence metadata.
712
+ - `kse auto governance session list [--limit <n>] [--status <csv>] [--resume-only] [--json]`: list persisted governance close-loop sessions (`--resume-only` filters to resumed-chain sessions only).
713
+ - `kse auto governance session stats [--days <n>] [--status <csv>] [--resume-only] [--json]`: aggregate governance close-loop session telemetry (completion/failure/convergence, rounds, risk/stop composition, and resumed-chain ratios/source counts).
714
+ - `kse auto governance session prune [--keep <n>] [--older-than-days <n>] [--dry-run] [--json]`: prune governance close-loop session archive by retention policy.
643
715
 
644
716
  Close-loop recovery memory maintenance:
645
717
  - `kse auto recovery-memory show [--scope <scope>] [--json]`: inspect persisted recovery signatures/actions and aggregate stats (optionally scoped)
@@ -653,6 +725,19 @@ Autonomous KPI trend:
653
725
  - `--csv` prints CSV rows to stdout and writes CSV when used with `--out` (JSON remains default).
654
726
  - JSON output includes `mode_breakdown` (batch/program/recover/controller/other run distribution), `anomaly_detection`, and flattened `anomalies` (latest-period regression checks against historical baseline).
655
727
 
728
+ Unified observability snapshot:
729
+ - `kse auto observability snapshot [--days <n>] [--status <csv>] [--weeks <n>] [--trend-mode <mode>] [--trend-period <period>] [--out <path>] [--json]`: generate one unified observability snapshot that combines close-loop session stats, batch stats, controller stats, governance session stats, governance health, and KPI trend.
730
+ - JSON output includes top-level `highlights` plus detailed archive/trend payloads under `snapshots`.
731
+
732
+ Agent-facing spec interfaces:
733
+ - `kse auto spec status <spec-name> [--json]`: structured status for one spec (`docs`, `task_progress`, `collaboration`, `health`).
734
+ - `kse auto spec instructions <spec-name> [--json]`: machine-readable execution instructions for one spec (`next_actions`, `priority_open_tasks`, recommended commands, document excerpts).
735
+
736
+ Autonomous archive schema compatibility:
737
+ - `kse auto schema check [--only <scopes>] [--json]`: scan archive schema compatibility (`schema_version`) for `close-loop-session`, `batch-session`, `controller-session`, and `governance-session`.
738
+ - `kse auto schema migrate [--only <scopes>] [--target-version <version>] [--apply] [--json]`: migrate/backfill `schema_version` across autonomous archives.
739
+ - Default mode is dry-run; use `--apply` to persist changes.
740
+
656
741
  Recommended `.kiro/config/orchestrator.json`:
657
742
 
658
743
  ```json
@@ -731,6 +816,14 @@ kse scene ontology show --package ./my-scene-package --json
731
816
  kse scene ontology deps --package <path> --ref <node-ref>
732
817
  kse scene ontology deps --package ./my-scene-package --ref entity:Order --json
733
818
 
819
+ # Analyze reverse dependency impact radius (what will be affected)
820
+ kse scene ontology impact --package <path> --ref <node-ref>
821
+ kse scene ontology impact --package ./my-scene-package --ref service:createOrder --relation depends_on,composes --max-depth 2 --json
822
+
823
+ # Find shortest ontology relation path between two refs
824
+ kse scene ontology path --package <path> --from <source-ref> --to <target-ref>
825
+ kse scene ontology path --package ./my-scene-package --from service:createOrder --to entity:Order --undirected --json
826
+
734
827
  # Validate ontology graph (detect dangling edges, cycles)
735
828
  kse scene ontology validate --package <path>
736
829
  kse scene ontology validate --package ./my-scene-package --json
@@ -268,6 +268,12 @@ Defined in `governance_contract.data_lineage`:
268
268
  }
269
269
  ```
270
270
 
271
+ ### Impact & Path Queries
272
+
273
+ Use ontology as an operational graph, not just static visualization:
274
+ - `impact`: reverse-traverse matching relations to estimate blast radius from one changed ref
275
+ - `path`: find the shortest relation path between two refs for dependency explainability
276
+
271
277
  ### Agent Hints
272
278
 
273
279
  The `agent_hints` field provides metadata for autonomous AI operation:
@@ -302,6 +308,14 @@ kse scene ontology show --package ./my-package --json
302
308
  kse scene ontology deps --package <path> --ref <node-ref>
303
309
  kse scene ontology deps --package ./my-package --ref entity:Order --json
304
310
 
311
+ # Query reverse impact radius
312
+ kse scene ontology impact --package <path> --ref <node-ref>
313
+ kse scene ontology impact --package ./my-package --ref service:createOrder --relation depends_on,composes --max-depth 2 --json
314
+
315
+ # Query shortest relation path between two refs
316
+ kse scene ontology path --package <path> --from <source-ref> --to <target-ref>
317
+ kse scene ontology path --package ./my-package --from service:createOrder --to entity:Order --undirected --json
318
+
305
319
  # Validate graph (dangling edges, cycles)
306
320
  kse scene ontology validate --package <path>
307
321
  kse scene ontology validate --package ./my-package --json