@besales/ops-framework 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.5
4
+
5
+ - Added `ops-agent learning-closeout <TASK>` as the default post-retrospective learning checkpoint.
6
+ - Expanded `learning-review.md` into per-learning approval cards with summary, target, source, reason, proposed change, scope, confidence, risk and decision.
7
+ - Preserved existing pending learning index entries when refreshing task-specific learning candidates.
8
+ - Added closeout guard coverage for `learning-closeout.md`, `learning-index.json`, `learning-review.md` and `learning-report.md`.
9
+ - Added generated project script support for `agent:learning-closeout`.
10
+
3
11
  ## 0.1.4
4
12
 
5
13
  - Switched generated project scripts from repeated `yarn dlx` execution to installed `ops-agent` package scripts.
package/README.md CHANGED
@@ -178,6 +178,7 @@ Do not commit that `file:` dependency to production projects. It is only for pac
178
178
  - `update-memory`
179
179
  - `learning-audit`
180
180
  - `learning-report`
181
+ - `learning-closeout`
181
182
  - `test/self-test`
182
183
 
183
184
  ## Learning Loop
@@ -201,6 +202,7 @@ ops-agent learning-review
201
202
  ops-agent learning-audit
202
203
  ops-agent update-memory --apply-approved
203
204
  ops-agent learning-report
205
+ ops-agent learning-closeout TASK-001-example
204
206
  ```
205
207
 
206
208
  `memory-candidates` creates structured learning cards with source, reason hash, learning layer, confidence, problem, lesson, repeat risk, proposed wording and suggested target. `learning-index` turns those cards into human-reviewable decisions. `update-memory` only writes approved entries when `--apply-approved` is passed.
@@ -209,6 +211,8 @@ ops-agent learning-report
209
211
 
210
212
  `learning-report` writes `ops/agent-pipeline/memory/learning-report.md`. Show the review pack before approval and the report during closeout so the human can see what the framework learned, what is still pending, and which approved entries were written to project memory or project playbooks.
211
213
 
214
+ `learning-closeout <TASK>` is the default closeout checkpoint after retrospective. It collects candidates from that task, refreshes `learning-index.json`, writes `learning-review.md`, writes `learning-report.md`, creates `learning-closeout.md` inside the task and updates `status.md` so human approval is visible. The review must show every learning candidate individually with summary, target, source artifact, reason, proposed change, scope, confidence, promotion risk and the current decision.
215
+
212
216
  Shared playbook candidates are intentionally manual-review only. Promote them through a separate reviewed framework task, not by auto-writing project-specific observations into the shared package.
213
217
 
214
218
  ## Feedback Intake
@@ -33,6 +33,7 @@ function main() {
33
33
  validateHumanGateSummary(taskDir, errors);
34
34
  validateFeedback(taskDir, errors);
35
35
  validateExecutionEvidence(taskDir, errors);
36
+ validateLearningCloseout(taskDir, errors);
36
37
  validateStatusSync(taskDir, errors);
37
38
 
38
39
  if (errors.length > 0) {
@@ -49,6 +50,30 @@ function main() {
49
50
  }
50
51
  }
51
52
 
53
+ function validateLearningCloseout(taskDir, errors) {
54
+ const stage = readStatusStage(taskDir);
55
+ const stagesRequiringLearningCloseout = new Set([
56
+ 'Closeout Audit',
57
+ 'Human Closeout Gate',
58
+ 'Closed',
59
+ 'Accepted',
60
+ 'Ready To Pause',
61
+ ]);
62
+ if (!stagesRequiringLearningCloseout.has(stage)) {
63
+ return;
64
+ }
65
+ const taskLearningCloseoutPath = path.join(taskDir, 'learning-closeout.md');
66
+ if (!fs.existsSync(taskLearningCloseoutPath)) {
67
+ errors.push('learning-closeout.md is missing before closeout. Run ops-agent learning-closeout <TASK> and show learning-review.md to human.');
68
+ }
69
+ for (const fileName of ['learning-index.json', 'learning-review.md', 'learning-report.md']) {
70
+ const filePath = path.join(projectContext.memoryRoot, fileName);
71
+ if (!fs.existsSync(filePath)) {
72
+ errors.push(`${fileName} is missing before closeout. Run ops-agent learning-closeout <TASK>.`);
73
+ }
74
+ }
75
+ }
76
+
52
77
  function validateHumanGateSummary(taskDir, errors) {
53
78
  const stage = readStatusStage(taskDir);
54
79
  if (stage !== 'Human Gate') {
@@ -3,9 +3,12 @@ import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import {
6
+ appendOrchestrationLog,
6
7
  getFlag,
7
8
  parseCliArgs,
8
9
  projectContext,
10
+ resolveTaskDir,
11
+ updateStatus,
9
12
  } from './lib/check-context-utils.mjs';
10
13
 
11
14
  export const CANDIDATES_FILE = 'learning-candidates.md';
@@ -13,6 +16,7 @@ export const INDEX_FILE = 'learning-index.json';
13
16
  export const APPROVED_FILE = 'approved-learning.md';
14
17
  export const REPORT_FILE = 'learning-report.md';
15
18
  export const REVIEW_FILE = 'learning-review.md';
19
+ export const CLOSEOUT_FILE = 'learning-closeout.md';
16
20
  const PROJECT_PLAYBOOK_TARGET_PREFIX = 'project-playbook/';
17
21
  const MEMORY_TARGET_PREFIX = 'memory/';
18
22
 
@@ -44,15 +48,22 @@ export function main() {
44
48
  writeLearningReport();
45
49
  return;
46
50
  }
47
- fail('Usage: ops-agent memory-candidates|learning-index|learning-review|update-memory|learning-audit|learning-report');
51
+ if (command === 'learning-closeout') {
52
+ writeLearningCloseout({
53
+ taskArg: args.positional[0] || getFlag(args, 'task'),
54
+ limit: Number(getFlag(args, 'limit', 20)),
55
+ });
56
+ return;
57
+ }
58
+ fail('Usage: ops-agent memory-candidates|learning-index|learning-review|update-memory|learning-audit|learning-report|learning-closeout');
48
59
  } catch (error) {
49
60
  fail(error.message);
50
61
  }
51
62
  }
52
63
 
53
- export function writeMemoryCandidates({ limit }) {
64
+ export function writeMemoryCandidates({ limit, taskDir = null } = {}) {
54
65
  ensureMemoryRoot();
55
- const candidates = collectLearningCandidates({ limit });
66
+ const candidates = collectLearningCandidates({ limit, taskDir });
56
67
  const content = [
57
68
  '# Learning Candidates',
58
69
  '',
@@ -81,32 +92,21 @@ export function writeMemoryCandidates({ limit }) {
81
92
  fs.writeFileSync(path.join(projectContext.memoryRoot, CANDIDATES_FILE), content.endsWith('\n') ? content : `${content}\n`);
82
93
  console.log(`Learning candidates written: ${path.join(projectContext.memoryRoot, CANDIDATES_FILE)}`);
83
94
  console.log(`- candidates: ${candidates.length}`);
95
+ return candidates;
84
96
  }
85
97
 
86
- export function writeLearningIndex() {
98
+ export function writeLearningIndex({ preserveExisting = true } = {}) {
87
99
  ensureMemoryRoot();
88
100
  const candidatesPath = path.join(projectContext.memoryRoot, CANDIDATES_FILE);
89
101
  if (!fs.existsSync(candidatesPath)) {
90
102
  throw new Error(`Missing ${CANDIDATES_FILE}. Run ops-agent memory-candidates first.`);
91
103
  }
92
- const entries = parseLearningCandidatesMarkdown(fs.readFileSync(candidatesPath, 'utf8'))
93
- .map((candidate) => ({
94
- id: candidate.id,
95
- source: candidate.source,
96
- sourceArtifact: candidate.sourceArtifact,
97
- reasonHash: candidate.reasonHash,
98
- kind: candidate.kind,
99
- learningLayer: candidate.learningLayer,
100
- confidence: candidate.confidence,
101
- problem: candidate.problem,
102
- lesson: candidate.lesson,
103
- repeatRisk: candidate.repeatRisk,
104
- candidate: candidate.text,
105
- proposedWording: candidate.proposedWording,
106
- decision: 'pending',
107
- target: candidate.suggestedTarget,
108
- notes: '',
109
- }));
104
+ const existingEntries = preserveExisting ? readExistingLearningEntries() : [];
105
+ const entries = mergeLearningIndexEntries({
106
+ candidateEntries: parseLearningCandidatesMarkdown(fs.readFileSync(candidatesPath, 'utf8'))
107
+ .map((candidate) => buildLearningIndexEntry(candidate, existingEntries)),
108
+ existingEntries,
109
+ });
110
110
  const index = {
111
111
  schemaVersion: 1,
112
112
  generatedAt: new Date().toISOString(),
@@ -116,6 +116,7 @@ export function writeLearningIndex() {
116
116
  fs.writeFileSync(path.join(projectContext.memoryRoot, INDEX_FILE), `${JSON.stringify(index, null, 2)}\n`);
117
117
  console.log(`Learning index written: ${path.join(projectContext.memoryRoot, INDEX_FILE)}`);
118
118
  console.log(`- entries: ${entries.length}`);
119
+ return index;
119
120
  }
120
121
 
121
122
  export function writeLearningReview({ memoryRoot = projectContext.memoryRoot, projectRoot = projectContext.projectRoot } = {}) {
@@ -173,6 +174,45 @@ export function writeLearningReview({ memoryRoot = projectContext.memoryRoot, pr
173
174
  fs.writeFileSync(path.join(memoryRoot, REVIEW_FILE), content.endsWith('\n') ? content : `${content}\n`);
174
175
  console.log(`Learning review written: ${path.join(memoryRoot, REVIEW_FILE)}`);
175
176
  console.log(`- pending: ${pending.length}`);
177
+ return {
178
+ entries,
179
+ pending,
180
+ reviewPath: path.join(memoryRoot, REVIEW_FILE),
181
+ };
182
+ }
183
+
184
+ export function writeLearningCloseout({ taskArg, limit = 20 } = {}) {
185
+ if (!taskArg) {
186
+ throw new Error('Usage: ops-agent learning-closeout <TASK-id-or-task-path> [--limit 20]');
187
+ }
188
+ const taskDir = resolveTaskDir(taskArg);
189
+ const taskId = path.basename(taskDir);
190
+ const candidates = writeMemoryCandidates({ limit, taskDir });
191
+ const index = writeLearningIndex({ preserveExisting: true });
192
+ const review = writeLearningReview();
193
+ writeLearningReport();
194
+ const closeoutPath = writeLearningCloseoutSummary({
195
+ taskDir,
196
+ taskId,
197
+ candidates,
198
+ entries: index.entries || [],
199
+ reviewPath: review.reviewPath,
200
+ });
201
+ updateStatus(taskDir, {
202
+ stage: 'Retrospective / Learning Review',
203
+ supervisorAction: 'Generated learning closeout candidates, review pack and report.',
204
+ nextStep: 'Show learning-review.md to human; set each learning-index.json decision to promote, defer, reject or rewrite; then run update-memory --apply-approved and learning-report.',
205
+ humanApproval: 'yes',
206
+ });
207
+ appendOrchestrationLog(taskDir, `learning closeout generated; candidates=${candidates.length}; review=${relativeProjectPath(review.reviewPath)}; summary=${path.basename(closeoutPath)}`);
208
+ console.log(`Learning closeout ready for ${taskId}`);
209
+ console.log(`- candidates: ${candidates.length}`);
210
+ console.log(`- review: ${relativeProjectPath(review.reviewPath)}`);
211
+ console.log(`- report: ${relativeProjectPath(path.join(projectContext.memoryRoot, REPORT_FILE))}`);
212
+ console.log(`- task summary: ${relativeProjectPath(closeoutPath)}`);
213
+ for (const line of renderConsoleLearningCards(index.entries || [])) {
214
+ console.log(line);
215
+ }
176
216
  }
177
217
 
178
218
  export function updateMemory({ applyApproved }) {
@@ -279,20 +319,26 @@ export function writeLearningReport({ memoryRoot = projectContext.memoryRoot, pr
279
319
  console.log(`Learning report written: ${path.join(memoryRoot, REPORT_FILE)}`);
280
320
  }
281
321
 
282
- export function collectLearningCandidates({ limit, tasksRoot = projectContext.tasksRoot } = {}) {
322
+ export function collectLearningCandidates({ limit, tasksRoot = projectContext.tasksRoot, taskDir = null } = {}) {
283
323
  const candidates = [];
284
324
  const seen = new Set();
285
- if (!fs.existsSync(tasksRoot)) {
325
+ const taskDirs = taskDir
326
+ ? [taskDir]
327
+ : fs.existsSync(tasksRoot)
328
+ ? fs.readdirSync(tasksRoot)
329
+ .filter((name) => name.startsWith('TASK-'))
330
+ .sort()
331
+ .reverse()
332
+ .map((name) => path.join(tasksRoot, name))
333
+ : [];
334
+ if (!taskDirs.length) {
286
335
  return candidates;
287
336
  }
288
- const taskDirs = fs.readdirSync(tasksRoot)
289
- .filter((name) => name.startsWith('TASK-'))
290
- .sort()
291
- .reverse();
292
- for (const taskName of taskDirs) {
337
+ for (const taskPath of taskDirs) {
338
+ const taskName = path.basename(taskPath);
293
339
  for (const fileName of ['retrospective.md', 'feedback.md', 'execution-feedback.md', 'verify.md', 'check.md']) {
294
340
  const sourceArtifact = `${taskName}/${fileName}`;
295
- const filePath = path.join(tasksRoot, taskName, fileName);
341
+ const filePath = path.join(taskPath, fileName);
296
342
  if (!fs.existsSync(filePath)) {
297
343
  continue;
298
344
  }
@@ -510,6 +556,78 @@ function suggestLearningTarget(text) {
510
556
  return `${MEMORY_TARGET_PREFIX}${APPROVED_FILE}`;
511
557
  }
512
558
 
559
+ function buildLearningIndexEntry(candidate, existingEntries) {
560
+ const previous = existingEntries.find((entry) => entry.reasonHash === candidate.reasonHash)
561
+ || existingEntries.find((entry) => entry.id === candidate.id);
562
+ return {
563
+ id: previous?.id || candidate.id,
564
+ source: candidate.source,
565
+ sourceArtifact: candidate.sourceArtifact,
566
+ reasonHash: candidate.reasonHash,
567
+ kind: candidate.kind,
568
+ learningLayer: candidate.learningLayer,
569
+ summary: candidate.lesson,
570
+ confidence: candidate.confidence,
571
+ problem: candidate.problem,
572
+ lesson: candidate.lesson,
573
+ repeatRisk: candidate.repeatRisk,
574
+ scope: scopeForTarget(previous?.target || candidate.suggestedTarget),
575
+ risk: riskForCandidate(candidate),
576
+ candidate: candidate.text,
577
+ proposedChange: previous?.proposedChange || candidate.proposedWording,
578
+ proposedWording: previous?.proposedWording || candidate.proposedWording,
579
+ decision: previous?.decision || 'pending',
580
+ target: previous?.target || candidate.suggestedTarget,
581
+ notes: previous?.notes || '',
582
+ };
583
+ }
584
+
585
+ function mergeLearningIndexEntries({ candidateEntries, existingEntries }) {
586
+ const seen = new Set(candidateEntries.map((entry) => entry.reasonHash || entry.id));
587
+ const preserved = existingEntries.filter((entry) => {
588
+ const key = entry.reasonHash || entry.id;
589
+ if (!key || seen.has(key)) {
590
+ return false;
591
+ }
592
+ seen.add(key);
593
+ return true;
594
+ });
595
+ return [...candidateEntries, ...preserved];
596
+ }
597
+
598
+ function readExistingLearningEntries() {
599
+ const indexPath = path.join(projectContext.memoryRoot, INDEX_FILE);
600
+ if (!fs.existsSync(indexPath)) {
601
+ return [];
602
+ }
603
+ try {
604
+ const index = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
605
+ return Array.isArray(index.entries) ? index.entries : [];
606
+ } catch {
607
+ return [];
608
+ }
609
+ }
610
+
611
+ function scopeForTarget(target) {
612
+ if (target?.startsWith('shared-playbook/')) {
613
+ return 'cross-project candidate; manual shared-framework review required before promotion.';
614
+ }
615
+ if (target?.startsWith(PROJECT_PLAYBOOK_TARGET_PREFIX)) {
616
+ return 'current project playbook overlay; project-specific procedures, routes, commands or runtime quirks.';
617
+ }
618
+ return 'current project memory; durable architecture, product or process knowledge.';
619
+ }
620
+
621
+ function riskForCandidate(candidate) {
622
+ if (candidate.suggestedTarget?.startsWith('shared-playbook/')) {
623
+ return 'High if promoted without validation: a task-specific observation could become cross-project guidance.';
624
+ }
625
+ if (candidate.confidence === 'low') {
626
+ return 'Medium: wording may be too vague or one-off; prefer defer/rewrite unless confirmed.';
627
+ }
628
+ return 'Low if reviewed: promotion is human-approved and source-linked.';
629
+ }
630
+
513
631
  function readMarkdownField(body, fieldName) {
514
632
  const pattern = new RegExp(`^- ${escapeRegExp(fieldName)}: (.*)$`, 'm');
515
633
  const match = pattern.exec(body);
@@ -622,24 +740,66 @@ function renderReviewEntries(entries) {
622
740
  return ['- None.'];
623
741
  }
624
742
  return entries.flatMap((entry) => [
625
- `### ${entry.id}`,
743
+ `### ${entry.id}: ${entry.summary || entry.lesson || entry.candidate || 'Learning candidate'}`,
626
744
  '',
627
- `- Source: \`${entry.sourceArtifact || entry.source}\``,
628
- `- Current decision: \`${entry.decision || 'pending'}\``,
745
+ `- Summary: ${entry.summary || entry.lesson || 'Not specified.'}`,
629
746
  `- Suggested target: \`${entry.target || 'memory/approved-learning.md'}\``,
630
- `- Kind: \`${entry.kind || 'unknown'}\``,
631
- `- Learning layer: \`${entry.learningLayer || learningLayerForKind(entry.kind)}\``,
747
+ `- Source artifact: \`${entry.sourceArtifact || entry.source}\``,
748
+ `- Reason hash: \`${entry.reasonHash || 'missing'}\``,
749
+ `- Reason: ${entry.problem || 'Not specified.'}`,
750
+ `- Proposed change: ${entry.proposedChange || entry.proposedWording || entry.candidate}`,
751
+ `- Scope: ${entry.scope || scopeForTarget(entry.target)}`,
632
752
  `- Confidence: \`${entry.confidence || 'unknown'}\``,
633
- `- Repeat risk: ${entry.repeatRisk || 'Not specified.'}`,
634
- `- Problem: ${entry.problem || 'Not specified.'}`,
635
- `- Lesson: ${entry.lesson || 'Not specified.'}`,
636
- `- Proposed wording: ${entry.proposedWording || entry.candidate}`,
753
+ `- Risk if promoted: ${entry.risk || 'Not specified.'}`,
754
+ `- Repeat risk if ignored: ${entry.repeatRisk || 'Not specified.'}`,
755
+ `- Current decision: \`${entry.decision || 'pending'}\``,
756
+ `- Human notes: ${entry.notes || '(empty)'}`,
637
757
  '',
638
758
  'Decision to set in `learning-index.json`: `promote | defer | reject | rewrite`',
639
759
  '',
640
760
  ]);
641
761
  }
642
762
 
763
+ function renderConsoleLearningCards(entries) {
764
+ const pending = entries.filter((entry) => !entry.decision || entry.decision === 'pending');
765
+ if (!pending.length) {
766
+ return ['- pending learning cards: none'];
767
+ }
768
+ return [
769
+ '- pending learning cards:',
770
+ ...pending.map((entry) => ` - ${entry.id}: ${entry.summary || entry.lesson || entry.candidate} -> ${entry.target || 'memory/approved-learning.md'}`),
771
+ ];
772
+ }
773
+
774
+ function writeLearningCloseoutSummary({ taskDir, taskId, candidates, entries, reviewPath }) {
775
+ const pending = entries.filter((entry) => !entry.decision || entry.decision === 'pending');
776
+ const content = [
777
+ '# Learning Closeout',
778
+ '',
779
+ `Task: \`${taskId}\``,
780
+ `Generated at: \`${new Date().toISOString()}\``,
781
+ '',
782
+ '## Human Action Required',
783
+ '',
784
+ `Review \`${relativeProjectPath(reviewPath)}\` and set every pending entry in \`${relativeProjectPath(path.join(projectContext.memoryRoot, INDEX_FILE))}\` to \`promote\`, \`defer\`, \`reject\` or \`rewrite\`.`,
785
+ '',
786
+ '## Summary',
787
+ '',
788
+ `- Candidates collected from this task: ${candidates.length}`,
789
+ `- Pending learning decisions: ${pending.length}`,
790
+ `- Learning review: \`${relativeProjectPath(reviewPath)}\``,
791
+ `- Learning report: \`${relativeProjectPath(path.join(projectContext.memoryRoot, REPORT_FILE))}\``,
792
+ '',
793
+ '## Pending Cards',
794
+ '',
795
+ ...renderReviewEntries(pending),
796
+ '',
797
+ ].join('\n');
798
+ const closeoutPath = path.join(taskDir, CLOSEOUT_FILE);
799
+ fs.writeFileSync(closeoutPath, content.endsWith('\n') ? content : `${content}\n`);
800
+ return closeoutPath;
801
+ }
802
+
643
803
  function relativeProjectPath(filePath, projectRoot = projectContext.projectRoot) {
644
804
  return path.relative(projectRoot, filePath) || path.basename(filePath);
645
805
  }
@@ -170,6 +170,29 @@ describe('learning loop', () => {
170
170
  const review = fs.readFileSync(path.join(memoryRoot, 'learning-review.md'), 'utf8');
171
171
  expect(review).toContain('## Human Approval Contract');
172
172
  expect(review).toContain('Decision to set in `learning-index.json`: `promote | defer | reject | rewrite`');
173
+ expect(review).toContain('### LC-001: Capture feedback at every stage.');
174
+ expect(review).toContain('- Summary: Capture feedback at every stage.');
175
+ expect(review).toContain('- Source artifact: `TASK-001/feedback.md`');
176
+ expect(review).toContain('- Reason hash: `missing`');
177
+ expect(review).toContain('- Proposed change: Project memory note: capture feedback at every stage.');
178
+ expect(review).toContain('- Scope: current project memory; durable architecture, product or process knowledge.');
179
+ expect(review).toContain('- Risk if promoted: Not specified.');
173
180
  expect(review).toContain('Project memory note: capture feedback at every stage.');
174
181
  });
182
+
183
+ it('collects closeout candidates from one task when taskDir is provided', () => {
184
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ops-learning-task-filter-'));
185
+ const taskA = path.join(root, 'TASK-001-current');
186
+ const taskB = path.join(root, 'TASK-002-other');
187
+ fs.mkdirSync(taskA, { recursive: true });
188
+ fs.mkdirSync(taskB, { recursive: true });
189
+ fs.writeFileSync(path.join(taskA, 'retrospective.md'), '- UI acceptance playbook should include current route.\n');
190
+ fs.writeFileSync(path.join(taskB, 'retrospective.md'), '- UI acceptance playbook should include other route.\n');
191
+
192
+ const candidates = collectLearningCandidates({ taskDir: taskA, tasksRoot: root, limit: 10 });
193
+
194
+ expect(candidates).toHaveLength(1);
195
+ expect(candidates[0].sourceArtifact).toBe('TASK-001-current/retrospective.md');
196
+ expect(candidates[0].text).toContain('current route');
197
+ });
175
198
  });
@@ -119,6 +119,7 @@ export function buildOpsScripts(packageSpec) {
119
119
  'agent:update-memory': run('update-memory'),
120
120
  'agent:learning-audit': run('learning-audit'),
121
121
  'agent:learning-report': run('learning-report'),
122
+ 'agent:learning-closeout': run('learning-closeout'),
122
123
  'agent:test': run('test/self-test'),
123
124
  };
124
125
  }
@@ -138,6 +138,7 @@ describe('buildOpsScripts', () => {
138
138
 
139
139
  expect(scripts.ops).toBe('ops-agent');
140
140
  expect(scripts['agent:quality-gates']).toBe('ops-agent quality-gates');
141
+ expect(scripts['agent:learning-closeout']).toBe('ops-agent learning-closeout');
141
142
  expect(scripts['agent:test']).toBe('ops-agent test/self-test');
142
143
  });
143
144
  });
package/bin/ops-agent.mjs CHANGED
@@ -32,6 +32,7 @@ const COMMANDS = new Map([
32
32
  ['update-memory', 'learning-loop.mjs'],
33
33
  ['learning-audit', 'learning-loop.mjs'],
34
34
  ['learning-report', 'learning-loop.mjs'],
35
+ ['learning-closeout', 'learning-loop.mjs'],
35
36
  ['test/self-test', null],
36
37
  ]);
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besales/ops-framework",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ops-agent": "bin/ops-agent.mjs"
@@ -193,7 +193,7 @@ Allowed ref types:
193
193
  - `human_arbitration_required` -> route to `Human Arbitration`;
194
194
  - `verifier_failed` -> остаться в `Verify` до remediation или провайдера/контекста.
195
195
  4. `Retrospective`: `retrospective.md` заполнен и содержит итоговый статус/verdict.
196
- 5. `Learning Loop Audit`: Supervisor запускает/проверяет `memory-candidates`, `learning-index`, `learning-review`, human decisions, `update-memory --apply-approved` для promoted entries and `learning-report`; human должен видеть, какие lessons предложены, какие отклонены/отложены and куда approved entries записаны.
196
+ 5. `Learning Loop Audit`: Supervisor запускает `learning-closeout <TASK>` или эквивалентную последовательность `memory-candidates`, `learning-index`, `learning-review`, human decisions, `update-memory --apply-approved` для promoted entries and `learning-report`; human должен видеть каждый learning отдельно: summary, target, source artifact, reason, proposed change, scope, confidence, risk, current decision и куда approved entries записаны.
197
197
  6. `Closeout Audit`: Supervisor проверяет `status.md`, `verify.md`, `verify.result.json`, `retrospective.md`, `orchestration-log.md`, `learning-report.md`, deferred/follow-up фиксацию и `git diff --check`.
198
198
  7. `Human Closeout Gate`: только после audit можно предлагать закрытие/паузу/task switch.
199
199
 
@@ -16,9 +16,11 @@
16
16
 
17
17
  ## Learning Loop Audit
18
18
 
19
+ - `ops-agent learning-closeout <TASK>` выполнен после заполнения retrospective: `[fill in]`
19
20
  - `ops-agent memory-candidates` выполнен после заполнения retrospective/check/verify feedback: `[fill in]`
20
21
  - `ops-agent learning-index` создал human-reviewable decisions: `[fill in]`
21
22
  - `ops-agent learning-review` создал human approval pack и был показан human: `[fill in]`
23
+ - Каждый learning показан human отдельной карточкой с summary/target/source/reason/proposed change/scope/confidence/risk/decision: `[fill in]`
22
24
  - `learning-index.json` reviewed human/supervisor: `[fill in]`
23
25
  - Promoted to project memory: `[fill in]`
24
26
  - Promoted to project playbooks: `[fill in]`