@besales/ops-framework 0.1.0

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 (70) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +328 -0
  3. package/bin/build-check-context.mjs +67 -0
  4. package/bin/build-execution-ledger.mjs +54 -0
  5. package/bin/estimate-llm-input.mjs +160 -0
  6. package/bin/guard-task.mjs +384 -0
  7. package/bin/hash-task-artifacts.mjs +44 -0
  8. package/bin/init-project.mjs +49 -0
  9. package/bin/intake-execution-feedback.mjs +207 -0
  10. package/bin/intake-feedback.test.mjs +73 -0
  11. package/bin/learning-loop.mjs +658 -0
  12. package/bin/learning-loop.test.mjs +175 -0
  13. package/bin/lib/bootstrap-utils.mjs +542 -0
  14. package/bin/lib/bootstrap-utils.test.mjs +156 -0
  15. package/bin/lib/check-context-utils.mjs +1448 -0
  16. package/bin/lib/check-context-utils.test.mjs +497 -0
  17. package/bin/lib/execution-ledger-utils.mjs +162 -0
  18. package/bin/lib/execution-ledger-utils.test.mjs +74 -0
  19. package/bin/lib/llm-input-pack-utils.mjs +663 -0
  20. package/bin/lib/llm-input-pack-utils.test.mjs +262 -0
  21. package/bin/lib/project-config.mjs +229 -0
  22. package/bin/lib/project-config.test.mjs +102 -0
  23. package/bin/lib/task-manifest-utils.mjs +512 -0
  24. package/bin/lib/task-manifest-utils.test.mjs +218 -0
  25. package/bin/lib/task-metrics-utils.mjs +63 -0
  26. package/bin/lib/task-metrics-utils.test.mjs +40 -0
  27. package/bin/lib/test-setup.mjs +37 -0
  28. package/bin/new-task.mjs +42 -0
  29. package/bin/ops-agent.mjs +81 -0
  30. package/bin/preflight.mjs +56 -0
  31. package/bin/providers/external-cli-checker.mjs +190 -0
  32. package/bin/providers/openai-checker.mjs +62 -0
  33. package/bin/quality-gates.mjs +92 -0
  34. package/bin/run-check.mjs +559 -0
  35. package/bin/run-plan-check-loop.mjs +392 -0
  36. package/bin/run-verify.mjs +627 -0
  37. package/bin/self-lint.mjs +88 -0
  38. package/bin/supervisor-turn.mjs +146 -0
  39. package/bin/supervisor-turn.test.mjs +72 -0
  40. package/bin/task-manifest.mjs +57 -0
  41. package/bin/task-metrics.mjs +48 -0
  42. package/bin/transition.mjs +94 -0
  43. package/bin/validate-check-artifacts.mjs +418 -0
  44. package/config/default-agents.json +100 -0
  45. package/package.json +28 -0
  46. package/playbooks/checker-context.md +9 -0
  47. package/playbooks/complexity-performance.md +13 -0
  48. package/playbooks/production-rollout.md +9 -0
  49. package/playbooks/source-sync-provider.md +9 -0
  50. package/playbooks/ui-acceptance.md +9 -0
  51. package/prompts/checker.md +170 -0
  52. package/prompts/executor.md +54 -0
  53. package/prompts/planner.md +128 -0
  54. package/prompts/researcher.md +44 -0
  55. package/prompts/supervisor.md +337 -0
  56. package/prompts/verifier.md +128 -0
  57. package/templates/brief.md +15 -0
  58. package/templates/check-resolution.md +69 -0
  59. package/templates/check-result.json +32 -0
  60. package/templates/check.md +46 -0
  61. package/templates/execution-feedback.md +25 -0
  62. package/templates/execution.md +101 -0
  63. package/templates/human-gate-summary.md +49 -0
  64. package/templates/orchestration-log.md +8 -0
  65. package/templates/plan.md +86 -0
  66. package/templates/research.md +13 -0
  67. package/templates/retrospective.md +48 -0
  68. package/templates/status.md +53 -0
  69. package/templates/verify-result.json +19 -0
  70. package/templates/verify.md +41 -0
@@ -0,0 +1,25 @@
1
+ # Execution Feedback
2
+
3
+ ## Feedback Event 1
4
+
5
+ - Received at: `YYYY-MM-DDTHH:mm:ss.sssZ`
6
+ - Source: `user`
7
+ - Raw feedback:
8
+ - Current stage when received: `Execute`
9
+ - Classification: `within_approved_scope | plan_patch_required | research_required | brief_reset_required | human_triage_required | human_arbitration_required`
10
+ - Rationale:
11
+ - Affected artifacts: `plan.md, research.md, brief.md, execution.md, verify.md`
12
+ - Supervisor decision: `stay_execute | return_plan | return_research | return_brief | human_triage | human_arbitration`
13
+ - Requires fresh Check: `yes | no`
14
+ - Requires new Human Gate: `yes | no`
15
+
16
+ ## Classification rules
17
+
18
+ - `within_approved_scope`: feedback does not invalidate approved `plan.md` or `check.md`.
19
+ - `plan_patch_required`: implementation path changes but task outcome does not.
20
+ - `research_required`: feedback reveals missing facts.
21
+ - `brief_reset_required`: feedback changes task frame, outcome, UI/data/analytics contour or lifecycle.
22
+ - `human_triage_required`: automation cannot classify feedback unambiguously.
23
+ - `human_arbitration_required`: feedback is a risk appetite, product tradeoff or architecture decision.
24
+
25
+ Feedback cannot modify execution until classified.
@@ -0,0 +1,101 @@
1
+ # Execution
2
+
3
+ ## Краткое summary
4
+
5
+ ## Risk tier / execution budget used
6
+
7
+ - Approved risk tier:
8
+ - Actual execution target:
9
+ - Fast-loop fixes made inside approved scope:
10
+ - Stop rules encountered:
11
+
12
+ ## Planned Item Coverage
13
+
14
+ | Plan item / section | Status (`done | partial | not_done | blocked | superseded`) | Evidence | Notes |
15
+ | --- | --- | --- | --- |
16
+
17
+ ## Preflight Evidence
18
+
19
+ | Check | Result | Evidence / notes |
20
+ | --- | --- | --- |
21
+ | Dev server / API availability | | |
22
+ | Browser / UI automation availability | | |
23
+ | Auth/session availability | | |
24
+ | DB target / representative data | | |
25
+ | Dirty worktree / unrelated files | | |
26
+
27
+ ## Execution Ledger
28
+
29
+ - `execution-ledger.json`: `present | not_generated`
30
+ - Command: `corepack yarn agent:build-execution-ledger <TASK-id>`
31
+ - Notes:
32
+
33
+ ## Измененные файлы
34
+
35
+ | File | Change summary | Planned item / reason |
36
+ | --- | --- | --- |
37
+
38
+ ## Запущенные команды
39
+
40
+ | Command | Result | Evidence / notes |
41
+ | --- | --- | --- |
42
+
43
+ ## Micro-verify evidence
44
+
45
+ | Assertion / check | Result | Evidence / notes |
46
+ | --- | --- | --- |
47
+
48
+ ## Slice-verify evidence
49
+
50
+ | Assertion / check | Result | Evidence / notes |
51
+ | --- | --- | --- |
52
+
53
+ ## UI Acceptance Evidence
54
+
55
+ Required when `plan.md` has `UI Acceptance Scenarios`.
56
+
57
+ | Scenario ID | Result (`pass | fail | blocked | human-owned`) | Observed evidence / screenshot / payload | Notes |
58
+ | --- | --- | --- | --- |
59
+ | UI-001 | | | |
60
+
61
+ ## Complexity / Performance Evidence
62
+
63
+ Required when `plan.md` has `Complexity / Performance Budget`.
64
+
65
+ | Hot path / budget | Result | Timing / rows / EXPLAIN / N+1 evidence | Notes |
66
+ | --- | --- | --- | --- |
67
+
68
+ ## Optimization Review Evidence
69
+
70
+ Required when `plan.md` has O2/O3 `Optimization Strategy`.
71
+
72
+ | Hot path | Tier | Review result | Evidence / deferred findings |
73
+ | --- | --- | --- | --- |
74
+
75
+ ## Production Rollout Evidence
76
+
77
+ Required when `plan.md` has `Production Rollout Gate`.
78
+
79
+ | Rollout check | Result | Env/deploy/rollback/post-deploy evidence | Notes |
80
+ | --- | --- | --- | --- |
81
+
82
+ ## Source Sync / Provider Evidence
83
+
84
+ Required when `plan.md` has `Source Sync / Provider Gate`.
85
+
86
+ | Provider/sync check | Result | Idempotency/retry/pagination/raw-record/coverage evidence | Notes |
87
+ | --- | --- | --- | --- |
88
+
89
+ ## Отклонения от плана
90
+
91
+ | Deviation | Reason | Impact | Follow-up / resolution |
92
+ | --- | --- | --- | --- |
93
+
94
+ ## Explicit Non-Actions
95
+
96
+ | Action not taken | Reason | Requires future Human Gate? |
97
+ | --- | --- | --- |
98
+
99
+ ## Блокеры
100
+
101
+ ## Follow-up notes
@@ -0,0 +1,49 @@
1
+ # Human Gate Summary
2
+
3
+ ## Task
4
+
5
+ `TASK-xxx`
6
+
7
+ ## Decision Needed
8
+
9
+ Approve moving from `Human Gate` to `Execute`, or ask a clarifying question before approval.
10
+
11
+ ## Problem We Are Solving
12
+
13
+ [Describe the problem.]
14
+
15
+ ## Approved Plan Summary
16
+
17
+ [Summarize the approved plan.]
18
+
19
+ ## Execution Approach
20
+
21
+ [Describe the execution approach.]
22
+
23
+ ## Human Gate Requirements
24
+
25
+ Before approval, human should confirm:
26
+
27
+ - [Approval item.]
28
+
29
+ ## What Approval Allows
30
+
31
+ After approval, Executor may:
32
+
33
+ - [Allowed action.]
34
+
35
+ ## What Remains Forbidden
36
+
37
+ Even after approval, Executor must not:
38
+
39
+ - [Forbidden action.]
40
+
41
+ ## Check Result
42
+
43
+ - Verdict: `ready_for_human_gate`
44
+ - Blocking findings: `0`
45
+ - Check result: `check.result.json`
46
+
47
+ ## Next Step
48
+
49
+ Human approves Execute or asks a clarifying question.
@@ -0,0 +1,8 @@
1
+ # Orchestration Log
2
+
3
+ ## Entries
4
+
5
+ - `YYYY-MM-DD HH:MM` — supervisor перевел задачу в этап `Brief`.
6
+ - `YYYY-MM-DD HH:MM` — вызван `Researcher`, ожидается `research.md`.
7
+ - `YYYY-MM-DD HH:MM` — вызван `Planner`, ожидается `plan.md`.
8
+ - `YYYY-MM-DD HH:MM` — plan gate: `approved | revision requested | scope changed`.
@@ -0,0 +1,86 @@
1
+ # Plan
2
+
3
+ ## Цель
4
+
5
+ ## Опора на research
6
+
7
+ ## Допущения
8
+
9
+ ## Затронутые модули и файлы
10
+
11
+ ## Risk tier and execution budget
12
+
13
+ - Risk tier: `R0 | R1 | R2 | R3 | R4 | R5`
14
+ - Speed mode: `Fast | Standard | Strict`
15
+ - Approved execution target:
16
+ - Fast-loop allowed inside this slice:
17
+ - Requires return to Plan/Check if:
18
+
19
+ ## UI Acceptance Scenarios
20
+
21
+ Required when the task is `panel-ui` or `ui-visible-api`. Do not use page-load-only smoke as acceptance.
22
+
23
+ | ID | User intent | Setup/data | Steps | Expected visible result | Must catch |
24
+ | --- | --- | --- | --- | --- | --- |
25
+ | UI-001 | | | | | |
26
+
27
+ ## Complexity / Performance Budget
28
+
29
+ Required for read-model, materializer, worker, production-runtime, dashboard/table UI, replay/backfill or other hot-path work.
30
+
31
+ - Hot paths:
32
+ - Expected data size / row counts:
33
+ - Complexity risks:
34
+ - Planned mitigation:
35
+ - Budget / stop rule:
36
+
37
+ ## Optimization Strategy
38
+
39
+ Required for O2/O3 hot-path work. Keep it bounded: prevent obvious inefficient design without turning delivery into an endless optimization loop.
40
+
41
+ - Optimization tier: `O0 none | O1 checklist | O2 focused review | O3 measured review`
42
+ - Hot paths:
43
+ - Expected data size / row counts:
44
+ - Chosen efficient approach:
45
+ - Anti-patterns explicitly avoided: `N+1 | repeated scan | nested O(n^2) | unbounded full scan | heavy render recompute`
46
+ - Optimizer budget / stop rule:
47
+ - Deferred optimization ideas:
48
+
49
+ ## Production Rollout Gate
50
+
51
+ Required for migrations, env vars, cron/workers, billing/auth, external APIs, deployment/runtime behavior, or production-readiness claims.
52
+
53
+ - Impact / blast radius:
54
+ - Environment / deploy variables:
55
+ - Rollback / disable path:
56
+ - Post-deploy evidence:
57
+
58
+ ## Source Sync / Provider Gate
59
+
60
+ Required for sync/import/provider pipelines, raw records, retries, pagination, rate limits, idempotency, replay/backfill, or partial failure recovery.
61
+
62
+ - Scope / provider window:
63
+ - Idempotency / duplicate handling:
64
+ - Failure handling / retry boundaries:
65
+ - Coverage / parity evidence:
66
+
67
+ ## Checker Context Hints
68
+
69
+ - Required repo files for Checker to inspect:
70
+ - Prior relevant failures:
71
+ - Exact questions Checker must answer:
72
+ - Relevant playbooks:
73
+
74
+ ## Шаги реализации
75
+
76
+ ## Риски и открытые вопросы
77
+
78
+ ## План проверки
79
+
80
+ ### Verification ladder
81
+
82
+ - Micro-verify during Execute:
83
+ - Slice-verify before completion:
84
+ - External Verify required before closeout: `yes | no`, reason:
85
+
86
+ ## Что требует human approval
@@ -0,0 +1,13 @@
1
+ # Research
2
+
3
+ ## Цель исследования
4
+
5
+ ## Подтвержденные repo findings
6
+
7
+ ## Затронутые модули и файлы
8
+
9
+ ## Риски и ограничения
10
+
11
+ ## Открытые вопросы
12
+
13
+ ## Рекомендации для planning
@@ -0,0 +1,48 @@
1
+ # Retrospective
2
+
3
+ ## Статус
4
+
5
+ `not_started`
6
+
7
+ ## Что сработало хорошо
8
+
9
+ ## Что вызвало лишние циклы
10
+
11
+ ## Переиспользуемые выводы
12
+
13
+ ## Какие обновления памяти нужны
14
+
15
+ ## Какие checklist или prompts стоит обновить
16
+
17
+ ## Learning Loop Audit
18
+
19
+ - `ops-agent memory-candidates` выполнен после заполнения retrospective/check/verify feedback: `[fill in]`
20
+ - `ops-agent learning-index` создал human-reviewable decisions: `[fill in]`
21
+ - `ops-agent learning-review` создал human approval pack и был показан human: `[fill in]`
22
+ - `learning-index.json` reviewed human/supervisor: `[fill in]`
23
+ - Promoted to project memory: `[fill in]`
24
+ - Promoted to project playbooks: `[fill in]`
25
+ - Shared playbook candidates requiring reviewed framework task: `[fill in]`
26
+ - `ops-agent update-memory --apply-approved` выполнен, если были approved entries: `[fill in]`
27
+ - `ops-agent learning-report` показан human перед closeout: `[fill in]`
28
+
29
+ ## Time Trace Audit
30
+
31
+ - Краткая трассировка времени по блокам: `[fill in]`
32
+ - Где время ушло на productive engineering: `[fill in]`
33
+ - Где время ушло на non-productive loops/tooling/waiting: `[fill in]`
34
+ - Нужна ли human escalation по framework optimization: `[fill in]`
35
+
36
+ Если значимая доля времени ушла на non-productive loops, external tooling, stale gates, browser/tool instability или unrelated dirty-worktree blockers, Supervisor обязан:
37
+ - показать human эту трассировку;
38
+ - предложить конкретную optimization policy;
39
+ - не менять framework/prompt/checklist самостоятельно без human approval.
40
+
41
+ ## Closeout audit
42
+
43
+ - `verify.md` содержит итоговый verdict: `[fill in]`
44
+ - `verify.result.json` существует, current и не блокирует Retrospective: `[fill in]`
45
+ - `status.md` обновлен до final/paused stage: `[fill in]`
46
+ - `orchestration-log.md` содержит closure/boundary decision: `[fill in]`
47
+ - deferred/follow-up work зафиксирован: `[fill in]`
48
+ - `git diff --check` после документационных правок: `[fill in]`
@@ -0,0 +1,53 @@
1
+ # Status
2
+
3
+ ## Task ID
4
+
5
+ ## Текущий этап
6
+
7
+ ## Текущий owner
8
+
9
+ ## Latest routing decision
10
+
11
+ ## Plan SHA
12
+
13
+ `sha256:required-in-phase-3`
14
+
15
+ ## Memory SHA
16
+
17
+ `sha256:required-in-phase-3`
18
+
19
+ ## Latest check verdict
20
+
21
+ `not_started | return_to_plan | ready_for_human_gate | human_arbitration_required | checker_failed`
22
+
23
+ ## Latest check result
24
+
25
+ - `check.result.json`: missing | present | stale | current
26
+
27
+ ## Latest check resolution
28
+
29
+ - `check-resolution.md`: not_required | missing | present | accepted_by_supervisor
30
+
31
+ ## Human Gate summary
32
+
33
+ - `human-gate-summary.md`: not_required | missing | present
34
+
35
+ ## Feedback intake
36
+
37
+ - `feedback.md`: no_events | unclassified_event | classified
38
+
39
+ ## Latest verify verdict
40
+
41
+ `not_started | pass | pass_with_notes | return_to_execute | return_to_plan | human_arbitration_required | verifier_failed`
42
+
43
+ ## Latest verify result
44
+
45
+ - `verify.result.json`: missing | present | stale | current
46
+
47
+ ## Последнее действие supervisor
48
+
49
+ ## Что ожидается на выходе текущего этапа
50
+
51
+ ## Нужен ли сейчас human approval
52
+
53
+ ## Следующий шаг
@@ -0,0 +1,19 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "taskId": "TASK-000-example",
4
+ "planSha": "sha256:required",
5
+ "executionSha": "sha256:required",
6
+ "verificationMode": "internal_supervisor",
7
+ "verifierProvider": "supervisor",
8
+ "verifierModel": "none",
9
+ "verifierRunId": "internal-supervisor-run-id-required",
10
+ "verdict": "pass",
11
+ "failureReason": null,
12
+ "readyForRetrospective": true,
13
+ "counts": {
14
+ "blockingFindings": 0,
15
+ "nonBlockingFindings": 0,
16
+ "questions": 0
17
+ },
18
+ "findings": []
19
+ }
@@ -0,0 +1,41 @@
1
+ # Verify
2
+
3
+ ## Verdict
4
+
5
+ `PASS | PASS_WITH_NOTES | FAIL`
6
+
7
+ ## Plan vs Execution Coverage
8
+
9
+ | Plan item / execution claim | Verification status (`verified | partial | contradicted | not_verified`) | Evidence | Finding ID |
10
+ | --- | --- | --- | --- |
11
+
12
+ ## Выполненные проверки
13
+
14
+ | Check | Command / method | Result | Notes |
15
+ | --- | --- | --- | --- |
16
+
17
+ ## Verification mode
18
+
19
+ `internal_supervisor | external_cli`
20
+
21
+ Use `internal_supervisor` for ordinary local R0-R3 slices when focused tests/build/lint/smoke evidence is sufficient. Use `external_cli` for R4/R5, production-readiness, destructive/security/financial/broad operational work, material migrations/backfills, broad ambiguous refactors or explicit human request.
22
+
23
+ ## Verification ladder coverage
24
+
25
+ | Level (`micro | slice | internal | external`) | Coverage | Evidence | Gaps |
26
+ | --- | --- | --- | --- |
27
+
28
+ ## UI/browser verification
29
+
30
+ ## Findings
31
+
32
+ | ID | Severity | Category | Claim | Expected correction |
33
+ | --- | --- | --- | --- |
34
+
35
+ ## Residual risks
36
+
37
+ ## Recommended next step
38
+
39
+ ## Structured Result
40
+
41
+ `verify.result.json` is required next to this file before Retrospective or Human Closeout Gate.