@awebai/oats 0.30.0 → 0.30.1

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 (118) hide show
  1. package/docs/desktop-cli-api.md +3 -3
  2. package/docs/implementation.md +2 -1
  3. package/docs/integrations.md +1 -1
  4. package/docs/knowledge.md +4 -4
  5. package/docs/official-catalog.md +3 -3
  6. package/docs/packages.md +8 -8
  7. package/docs/plans/0.30-close-out.md +24 -2
  8. package/docs/release-lane.md +7 -2
  9. package/docs/release-notes/v0.30.1.md +123 -0
  10. package/docs/souls-and-instances.md +2 -2
  11. package/docs/workspaces.md +6 -1
  12. package/lib/packages.mjs +1 -1
  13. package/lib/resolve.mjs +1 -1
  14. package/package-catalog.json +2 -2
  15. package/package.json +1 -3
  16. package/skills/oats-getting-started/SKILL.md +1 -1
  17. package/capabilities/oats-authoring/LICENSE +0 -21
  18. package/capabilities/oats-authoring/oats-package.json +0 -11
  19. package/capabilities/oats-authoring/oats.json +0 -12
  20. package/capabilities/oats-authoring/skills/integration-authoring/SKILL.md +0 -84
  21. package/capabilities/oats-authoring/skills/skill-craft/SKILL.md +0 -109
  22. package/capabilities/oats-authoring/skills/soul-craft/SKILL.md +0 -116
  23. package/capabilities/oats-aweb/bin/oats-aweb-binding.mjs +0 -11
  24. package/capabilities/oats-aweb/bin/oats-aweb.mjs +0 -1672
  25. package/capabilities/oats-aweb/injects/aweb.md +0 -47
  26. package/capabilities/oats-aweb/lib/binding-wire.mjs +0 -365
  27. package/capabilities/oats-aweb/lib/captured-execution.mjs +0 -91
  28. package/capabilities/oats-aweb/lib/captured-native.mjs +0 -91
  29. package/capabilities/oats-aweb/lib/grant-custody.mjs +0 -38
  30. package/capabilities/oats-aweb/lib/invocation-shape.mjs +0 -135
  31. package/capabilities/oats-aweb/lib/portable-binding.mjs +0 -146
  32. package/capabilities/oats-aweb/lib/session-readiness.mjs +0 -56
  33. package/capabilities/oats-aweb/lib/wake-receive.mjs +0 -56
  34. package/capabilities/oats-aweb/oats.json +0 -201
  35. package/capabilities/oats-aweb/skills/LICENSE +0 -21
  36. package/capabilities/oats-aweb/skills/VENDORED.md +0 -31
  37. package/capabilities/oats-aweb/skills/aweb-identity/SKILL.md +0 -201
  38. package/capabilities/oats-aweb/skills/aweb-messaging/SKILL.md +0 -161
  39. package/capabilities/oats-aweb/skills/aweb-messaging/references/messaging-scenarios.md +0 -61
  40. package/capabilities/oats-aweb/skills/aweb-team-membership/SKILL.md +0 -116
  41. package/capabilities/oats-aweb/skills/aweb-team-membership/references/team-membership-reference.md +0 -74
  42. package/capabilities/oats-aweb/skills/oats-aweb/SKILL.md +0 -286
  43. package/capabilities/oats-code-review/injects/reviewer.md +0 -26
  44. package/capabilities/oats-code-review/oats.json +0 -16
  45. package/capabilities/oats-code-review/skills/adversarial-review/SKILL.md +0 -66
  46. package/capabilities/oats-code-review/skills/review-dev-docs/SKILL.md +0 -30
  47. package/capabilities/oats-code-review/skills/security-review/SKILL.md +0 -56
  48. package/capabilities/oats-code-review/skills/simplification-review/SKILL.md +0 -34
  49. package/capabilities/oats-developer/injects/developer.md +0 -38
  50. package/capabilities/oats-developer/oats.json +0 -17
  51. package/capabilities/oats-developer/skills/execution-strategy/SKILL.md +0 -43
  52. package/capabilities/oats-developer/skills/maintain-dev-docs/SKILL.md +0 -47
  53. package/capabilities/oats-developer/skills/run-the-review-loop/SKILL.md +0 -65
  54. package/capabilities/oats-developer/skills/understand-the-spec/SKILL.md +0 -37
  55. package/capabilities/oats-developer/skills/worktrees/SKILL.md +0 -36
  56. package/capabilities/oats-engineering-expert/injects/expert.md +0 -37
  57. package/capabilities/oats-engineering-expert/oats.json +0 -17
  58. package/capabilities/oats-engineering-expert/skills/coordinate-developers/SKILL.md +0 -37
  59. package/capabilities/oats-engineering-expert/skills/coordinate-experts/SKILL.md +0 -52
  60. package/capabilities/oats-engineering-expert/skills/land-your-prs/SKILL.md +0 -50
  61. package/capabilities/oats-engineering-expert/skills/plan-and-spec/SKILL.md +0 -53
  62. package/capabilities/oats-engineering-expert/skills/verify-developer-work/SKILL.md +0 -49
  63. package/capabilities/oats-jira/bin/oats-jira.mjs +0 -40
  64. package/capabilities/oats-jira/injects/jira.md +0 -10
  65. package/capabilities/oats-jira/oats.json +0 -22
  66. package/capabilities/oats-jira/skills/jira-tasks/SKILL.md +0 -179
  67. package/capabilities/oats-linear/bin/oats-linear-hook.mjs +0 -34
  68. package/capabilities/oats-linear/bin/oats-linear.mjs +0 -344
  69. package/capabilities/oats-linear/injects/linear.md +0 -8
  70. package/capabilities/oats-linear/oats.json +0 -24
  71. package/capabilities/oats-linear/skills/linear-tasks/SKILL.md +0 -223
  72. package/capabilities/oats-okf/bin/oats-okf-binding.mjs +0 -14
  73. package/capabilities/oats-okf/bin/oats-okf.mjs +0 -213
  74. package/capabilities/oats-okf/injects/okf.md +0 -42
  75. package/capabilities/oats-okf/lib/binding-wire.mjs +0 -380
  76. package/capabilities/oats-okf/lib/captured-worker.mjs +0 -109
  77. package/capabilities/oats-okf/lib/config.mjs +0 -124
  78. package/capabilities/oats-okf/lib/consult.mjs +0 -518
  79. package/capabilities/oats-okf/lib/harvest-status.mjs +0 -88
  80. package/capabilities/oats-okf/lib/harvest-switch.mjs +0 -94
  81. package/capabilities/oats-okf/lib/inspection.mjs +0 -138
  82. package/capabilities/oats-okf/lib/invocation-context.mjs +0 -111
  83. package/capabilities/oats-okf/lib/invocation-shape.mjs +0 -135
  84. package/capabilities/oats-okf/lib/io.mjs +0 -118
  85. package/capabilities/oats-okf/lib/migration.mjs +0 -137
  86. package/capabilities/oats-okf/lib/okf-validate.mjs +0 -123
  87. package/capabilities/oats-okf/lib/portable-binding.mjs +0 -199
  88. package/capabilities/oats-okf/lib/source-contract.mjs +0 -46
  89. package/capabilities/oats-okf/lib/sources.mjs +0 -438
  90. package/capabilities/oats-okf/lib/stores.mjs +0 -473
  91. package/capabilities/oats-okf/lib/worker.mjs +0 -486
  92. package/capabilities/oats-okf/oats.json +0 -151
  93. package/capabilities/oats-okf/schemas/okf-base.schema.json +0 -46
  94. package/capabilities/oats-okf/schemas/okf-bindings.schema.json +0 -112
  95. package/capabilities/oats-okf/schemas/okf-portable-declaration.schema.json +0 -87
  96. package/capabilities/oats-okf/schemas/okf-portable-payload.schema.json +0 -113
  97. package/capabilities/oats-okf/schemas/okf-soul.schema.json +0 -37
  98. package/capabilities/oats-okf/skills/okf-consultation/SKILL.md +0 -144
  99. package/capabilities/oats-okf/skills/okf-consultation/references/consult.md +0 -86
  100. package/capabilities/oats-okf/skills/okf-instance-knowledge/SKILL.md +0 -104
  101. package/capabilities/oats-okf-harvest/bin/okf-harvest.mjs +0 -140
  102. package/capabilities/oats-okf-harvest/injects/harvester.md +0 -12
  103. package/capabilities/oats-okf-harvest/oats.json +0 -26
  104. package/capabilities/oats-okf-harvest/skills/knowledge-harvest/SKILL.md +0 -168
  105. package/capabilities/oats-okf-harvest/skills/knowledge-theory/SKILL.md +0 -192
  106. package/capabilities/oats-okf-harvest/skills/okf-authoring/SKILL.md +0 -151
  107. package/capabilities/oats-okf-harvest/skills/okf-authoring/scripts/okf-validate.mjs +0 -123
  108. package/capabilities/oats-okf-maintenance/bin/okf-maintenance.mjs +0 -170
  109. package/capabilities/oats-okf-maintenance/injects/maintainer.md +0 -12
  110. package/capabilities/oats-okf-maintenance/lib/provenance.mjs +0 -50
  111. package/capabilities/oats-okf-maintenance/oats.json +0 -21
  112. package/capabilities/oats-okf-maintenance/skills/knowledge-review/SKILL.md +0 -159
  113. package/capabilities/oats-okf-maintenance/skills/knowledge-theory/SKILL.md +0 -192
  114. package/capabilities/oats-okf-maintenance/skills/okf-authoring/SKILL.md +0 -151
  115. package/capabilities/oats-okf-maintenance/skills/okf-authoring/scripts/okf-validate.mjs +0 -123
  116. package/capabilities/oats-okf-maintenance/skills/okf-trigger-setup/SKILL.md +0 -134
  117. package/capabilities/oats-workspace-experts/injects/oats-experts.md +0 -26
  118. package/capabilities/oats-workspace-experts/oats.json +0 -9
@@ -1,213 +0,0 @@
1
- #!/usr/bin/env node
2
- import { fs, join, resolve, readJSON, safePath, oats, fail, unlock, redactUrls } from '../lib/io.mjs';
3
- import { loadBindings } from '../lib/config.mjs';
4
- import { register, registerCaptured, loadInvocationSourceReceipt, homeSource, loadSource, loadStatus, saveStatus, updateStatus, capture, scheduleSource, settleRetiredSchedule, service, markerPath, harvestOffRecord, sourceSwitch, retireHarvestOff, consultSource } from '../lib/sources.mjs';
5
- import { harvestStatus, setupHarvest } from '../lib/harvest-status.mjs';
6
- import { settings } from '../lib/config.mjs';
7
- import { CONSULT } from '../lib/consult.mjs';
8
- import { runSource, complete, retry, readRun, requireQualifiedHelper } from '../lib/worker.mjs';
9
- import { initBase, migrate, deliverMigration, cutoverMigration, migrateSource, forgetMigration } from '../lib/migration.mjs';
10
- import { inspect, inspectConsultOnly } from '../lib/inspection.mjs';
11
- import { loadInvocationKnowledgeBinding } from '../lib/binding-wire.mjs';
12
- import { loadCapturedOkfInvocation, loadOkfSourceReceiptInput, assertOkfInvocationAction, requireOkfAdmittedAction, assertOkfSourceContext, assertOkfRegisteredSourceReplay } from '../lib/invocation-context.mjs';
13
- const HELP=`oats okf inspect [--home PATH | --source FILE] [--json]
14
- oats okf harvest [--home PATH] [--no-launch] [--json]
15
- oats okf run-source --source FILE [--manual] [--no-launch] [--json]
16
- oats okf complete --source FILE --run ID --judgment FILE [--json]
17
- oats okf retry --source FILE [--run ID --rejudge | --rejudge | --launch | --adopt-home PATH] [--json]
18
- oats okf bases [--fresh] [--json]
19
- oats okf index [--base ALIAS] [NODE | ALIAS/NODE] [--fresh] [--json]
20
- oats okf cat --base ALIAS PATH [--from PATH] [--fresh] [--json]
21
- oats okf ls --base ALIAS [DIR] [--fresh] [--json]
22
- oats okf links --base ALIAS PATH [--fresh] [--json]
23
- oats okf search [--base ALIAS | --all] [--node NODE] [--regex] [--case-sensitive] TEXT [--fresh] [--json]
24
- Consult commands read the accepted state remotely (host cache, no local copy);
25
- also accept --home PATH | --source FILE. PATH is /node/x.md from the base root,
26
- relative to --from's directory, or bare node/x.md from the root.
27
- oats okf setup --source FILE [--enable | --disable] [--install-host] [--json]
28
- oats okf setup --harvest on|off [--json] (writes oats-local.yaml settings.oats.okf.harvest)
29
- oats okf harvest-status [--soul NAME] [--json] (the effective harvest switch, why, and the registered sources)
30
- oats okf init --base ALIAS --nodes FILE [--output PATH | --confirm] [--json]
31
- oats okf migrate --legacy PATH --base ALIAS --node NODE --output PATH [--json]
32
- oats okf migrate --deliver FILE | --cutover FILE --soul-dir PATH [--json]
33
- oats okf migrate --source-home PATH [--json]
34
- oats okf migrate --forget ID [--json]
35
- oats okf unlock --lock PATH --token TOKEN [--json]
36
- Captured workers use oats operation run knowledge:harvest with SOURCE --deployment/--resolution/--home,
37
- --arg native-request=ABS_BACKEND_ONLY_JSON and optional --arg worker-mode=prepare|launch.
38
- Raw captured harvest/run-source/scheduler/rejudge remain held; completed runs use SOURCE complete/retry.
39
- Unknown scaffold/native outcomes are retained, never automatically re-scaffolded or redispatched.
40
- Explicit retry --run ID requires --rejudge; add --launch only for operator-approved launch.
41
- Closed-PR recovery uses retained evidence and a fresh run; complete its returned ID.
42
- Settled destinations and old proposals/receipts are preserved; another active run blocks recovery.
43
- All settings use one absolute bindings-file. Setup host installation is explicit.
44
- `;
45
- const args=process.argv.slice(2);
46
- if(args.includes('--help') || args.includes('-h')) {process.stdout.write(HELP);}
47
- else {
48
- const event=process.env.OATS_EVENT || args[0];
49
- const hook=['spawn','retire','soul-scaffold'].includes(event);
50
- const consult=Object.hasOwn(CONSULT,event);
51
- let exit=0,answer,text,textMode=consult && !args.includes('--json');
52
- try {
53
- const flags={},positionals=[]; const boolean=new Set(['json','no-launch','manual','rejudge','launch','enable','disable','install-host','confirm','fresh','all','regex','case-sensitive']);
54
- for(let i=1;i<args.length;i++) {
55
- if(consult && args[i]==='--') {positionals.push(...args.slice(i+1));break;}
56
- if(!args[i].startsWith('--')) {if(!consult) fail('E_USAGE',`unexpected argument ${args[i]}`);positionals.push(args[i]);continue;}
57
- const k=args[i].slice(2);if(k in flags) fail('E_USAGE',`duplicate --${k}`);
58
- if(boolean.has(k)) flags[k]=true;
59
- else {if(!args[i+1] || args[i+1].startsWith('--')) fail('E_USAGE',`--${k} needs a value`);flags[k]=args[++i];}
60
- }
61
- const accepted={
62
- spawn:[],retire:['home'], 'soul-scaffold':[],
63
- harvest:['home','no-launch','native-request','worker-mode'],inspect:['home','source'],
64
- 'run-source':['source','manual','no-launch'],complete:['source','run','judgment'],
65
- retry:['source','run','rejudge','launch','adopt-home'],read:['home','source','base','path','fresh'],refresh:['home','source'],'harvest-status':['home'],
66
- bases:['home','source','fresh'],index:['home','source','base','fresh'],cat:['home','source','base','from','fresh'],ls:['home','source','base','fresh'],
67
- links:['home','source','base','fresh'],search:['home','source','base','all','node','regex','case-sensitive','fresh'],
68
- setup:['source','enable','disable','install-host','harvest'],init:['base','nodes','output','confirm'],
69
- migrate:['source-home','legacy','base','node','output','deliver','cutover','soul-dir'],unlock:['lock','token']
70
- };
71
- for(const k of Object.keys(flags)) if(!['json','soul',...(accepted[event] || [])].includes(k)) fail('E_USAGE',`unknown flag --${k} for ${event}`);
72
- if(flags.source && flags.home) fail('E_USAGE','choose source descriptor OR home');
73
- const execution=Object.hasOwn(process.env,'OATS_INVOCATION_CONTEXT_FILE')?loadCapturedOkfInvocation():null;
74
- const invocation=execution?{kind:'captured',binding:execution.binding}:loadInvocationKnowledgeBinding(),captured=invocation.kind==='captured';
75
- if(execution) assertOkfInvocationAction(execution.context,event,readJSON(new URL('../oats.json',import.meta.url)));
76
- // Only an actual admitted, instance-scoped kernel operation can create a
77
- // captured worker. Raw commands/null intents and legacy ingress stay closed.
78
- const capturedHarvest=captured && execution?.context.action.kind==='operation' && execution.context.action.slot==='knowledge' && execution.context.action.name==='harvest';
79
- if(captured && event==='harvest') {
80
- if(!capturedHarvest)requireQualifiedHelper({providerBinding:invocation.binding});
81
- requireOkfAdmittedAction(execution.context);
82
- if(!flags['native-request']||!['prepare','launch'].includes(flags['worker-mode']||'launch'))fail('E_CAPTURED_HELPER','captured harvest needs explicit native-request and supported worker-mode');
83
- }
84
- const unsupportedCaptured=new Set(['setup','init','migrate','unlock']);
85
- if(captured && unsupportedCaptured.has(event)) fail('E_MIGRATION',`captured ${event} is not supported; use an explicit operator administration path`);
86
- const target=execution?.context.instance;
87
- if(target && flags.home && resolve(flags.home)!==target.home) fail('E_INVOCATION','captured invocation target differs from requested home');
88
- const home=target?.home || resolve(flags.home || (execution?process.cwd():process.env.OATS_INSTANCE_HOME || process.env.OATS_HOME || process.cwd()));
89
- if(execution && ['spawn','retire'].includes(event)) requireOkfAdmittedAction(execution.context);
90
- const sourceReceipt=execution?loadOkfSourceReceiptInput(execution):loadInvocationSourceReceipt(home);
91
- if(sourceReceipt.mode==='captured' && !['spawn','retire'].includes(event)) fail('E_SOURCE','captured source receipt is valid only for lifecycle hooks');
92
- const src=()=>{
93
- try {
94
- const source=flags.source?loadSource(resolve(flags.source)):homeSource(home);
95
- if(execution) assertOkfSourceContext(source,execution.context,execution.binding);
96
- else if(captured) assertOkfRegisteredSourceReplay(source,invocation.binding);
97
- else if(source.providerBinding && event!=='inspect') fail('E_INVOCATION','captured source execution requires its selected binding');
98
- return source;
99
- } catch(error) {if(captured && ['ENOENT','ENOTDIR'].includes(error.code)) fail('E_SOURCE','captured command requires its durable registered source descriptor');throw error;}
100
- };
101
- // okf 4.0.3: consultation never depends on harvest. A home spawned with
102
- // harvest off has no registered source by design; it consults through its
103
- // soul's declaration and the deployment's bindings (consultSource).
104
- const consultOnly=!flags.source && !captured && !execution && !fs.existsSync(markerPath(home)) && !!harvestOffRecord(home);
105
- // Deliberate old registered-source replay is a separate qualified contract,
106
- // never a way to create a source or synthesize generic admission. A present
107
- // invalid/unadmitted generic invocation cannot enter this compatibility path.
108
- if(captured && !execution && Object.hasOwn(accepted,event) && event!=='soul-scaffold') {
109
- if(!fs.existsSync(flags.source?resolve(flags.source):markerPath(home))) fail('E_ADMISSION','new captured registration requires generic admitted invocation inputs');
110
- src();
111
- }
112
- if(['spawn','retire'].includes(event)) {
113
- // A generic intent authorizes its action, not missing source/role input.
114
- // Absence may replay an already qualified source, never create one or
115
- // infer a helper skip from an ambient kind/name/knowledge-slot heuristic.
116
- if(captured && sourceReceipt.mode!=='captured' && !fs.existsSync(markerPath(home))) fail('E_SOURCE','new captured registration requires SourceReceipt1 input authority');
117
- if(execution && fs.existsSync(markerPath(home))) src();
118
- if(!captured && fs.existsSync(join(home,'instance.json')) && Object.hasOwn(readJSON(safePath(join(home,'instance.json'))),'executionBinding')) fail('E_INVOCATION','captured home cannot use legacy lifecycle ingress');
119
- }
120
- // Scope commands have no kernel instance intent. They may finish only
121
- // already retained runs under their exact source binding/descriptor, never
122
- // allocate a new worker or infer an incarnation for a deleted source.
123
- const retainedRun=s=>{
124
- const id=event==='complete'?flags.run:loadStatus(s).activeRun;
125
- if(!id) {if(event==='complete') fail('E_RUN','complete requires an existing --run');requireQualifiedHelper(s);}
126
- readRun(s,id);return s;
127
- };
128
- let result;
129
- if(event==='read') fail('E_REMOVED','okf 4.0.0 removed read: use `oats okf cat --base ALIAS PATH` (same path, text and receipt)');
130
- if(consult) {const answer=CONSULT[event](consultOnly?consultSource(home):src(),flags,positionals);result=answer.result;text=answer.text;}
131
- else if(event==='refresh') fail('E_REMOVED','okf 3.0.0 has no per-instance views; index/cat always read the accepted state: run `oats okf index`, then `oats okf cat --base ALIAS PATH`');
132
- else if(event==='harvest-status') result=harvestStatus({home,flags});
133
- else if(event==='soul-scaffold') {
134
- // Souls are portable declarations, never an implicit knowledge store.
135
- result={meta:{scaffolded:false},brief:'OKF requires explicit external bindings and soul/okf.json before a working instance can spawn. Use init or migrate; no knowledge was created in this soul.'};
136
- } else if(event==='spawn') {
137
- const s=sourceReceipt.mode==='captured'?registerCaptured(home,sourceReceipt.receipt):register(home);
138
- const nodes=(list)=>list.join(', ') || 'none';
139
- const brief=decl=>`Your soul knowledge is read remotely at its accepted state; there is no local copy. Start every task with your instance knowledge (STATE.md, log.md, notes/), then \`oats okf index\` (owns: ${nodes(decl.owns)}; reads: ${nodes(decl.reads.filter(r=>!decl.owns.includes(r)))}) and \`oats okf cat --base ALIAS PATH\` for the concepts the task needs; \`oats okf search\` before re-deriving a decision. Load okf-consultation and okf-instance-knowledge. Never edit accepted knowledge.`;
140
- if(s.skipped) result={meta:{memory:'none'},brief:'Service agent: follow your own task; no working-memory upkeep.'};
141
- else if(s.harvestOff) result={meta:{memory:'okf-v2',harvest:'off',reason:s.switch.reason},brief:`${brief(s.decl)} Harvest is off for this instance: nothing of this session is captured.`,...(s.switch.warnings.length?{warning:`oats-okf: ${s.switch.warnings.join('; ')}`}:{})};
142
- else {
143
- const schedule=loadStatus(s).schedule.result;
144
- result={meta:{memory:'okf-v2',harvest:'on',source:s.file,schedule},brief:`${brief(s.decl)} Harvest is on: your notes and session are captured for the knowledge harvester.`};
145
- }
146
- } else if(event==='retire') {
147
- if(captured) {
148
- let s;
149
- if(sourceReceipt.mode==='captured') {s=registerCaptured(home,sourceReceipt.receipt);if(s.skipped) {result={meta:{retired:true,reason:'service'}};s=null;}}
150
- else {if(!fs.existsSync(markerPath(home))) fail('E_MIGRATION','captured retire requires a durable registered source or explicit helper receipt');s=src();}
151
- if(s) {scheduleSource(s);const r=capture(s,{final:true});const schedule=settleRetiredSchedule(s);result={meta:{retired:r.complete===true,source:s.file,capture:r,schedule},brief:'Final input is in durable custody. Delivery remains asynchronous.'};}
152
- } else if(service(home)) result={meta:{retired:true}};
153
- else if(!fs.existsSync(markerPath(home)) && harvestOffRecord(home)) result={meta:{retired:true,reason:'harvest-off'}};
154
- else if(!fs.existsSync(markerPath(home))) {
155
- if(['STATE.md','log.md','notes','.okf-harvest-record.json','.okf-harvest-record.next.json'].some(p=>fs.existsSync(join(home,p)))) fail('E_MIGRATION','unregistered/legacy source has memory; explicitly migrate/register before retirement');
156
- result={meta:{retired:true,reason:'nothing-to-delete'}};
157
- } else {
158
- const s=src(),sw=sourceSwitch(s);
159
- // okf 4.0.1 #6: harvest switched off since spawn (deployment or soul) → no final capture.
160
- if(sw.effective!=='on') result={meta:retireHarvestOff(s,sw),brief:`Harvest is now off (${sw.reason}): no final capture was taken; earlier inputs stay in custody.`};
161
- else {scheduleSource(s);const r=capture(s,{final:true});const schedule=settleRetiredSchedule(s);result={meta:{retired:r.complete===true,source:s.file,capture:r,schedule},brief:'Final input is in durable custody. Delivery remains asynchronous.'};}
162
- }
163
- } else if(event==='harvest') {
164
- if(capturedHarvest) {
165
- const s=src(); // existing registered descriptor ONLY; never new registration.
166
- result=runSource(s,{manual:true,noLaunch:!!flags['no-launch']||flags['worker-mode']==='prepare',capturedInvocation:execution.context,nativeRequest:flags['native-request']});
167
- } else {
168
- if(flags['native-request']||flags['worker-mode'])fail('E_USAGE','native-request/worker-mode require an admitted captured operation');
169
- // Snapshot absence does not turn a persisted captured source into legacy.
170
- if(fs.existsSync(markerPath(home))) requireQualifiedHelper(src());
171
- const s=register(home);
172
- if(s.harvestOff) fail('E_HARVEST_OFF',`harvest is off for this instance: ${s.switch.reason}. Nothing was captured.`);
173
- result=s.skipped?{status:'skipped',reason:'service'}:runSource(s,{manual:true,noLaunch:!!flags['no-launch']});
174
- }
175
- } else if(event==='run-source') {
176
- // The deployment can switch harvest off after a source registered: the
177
- // job then captures and processes nothing (the soul's opt-out was already
178
- // applied at registration). Nothing drains when it is switched back on.
179
- const source=src(),sw=sourceSwitch(source);
180
- result=sw.effective!=='on'?{status:'harvest-off',source:source.file,reason:`${sw.reason}; nothing was captured`}
181
- :runSource(source,{manual:!!flags.manual,noLaunch:!!flags['no-launch']});
182
- }
183
- else if(event==='complete') {const s=src();if(captured) retainedRun(s);result=complete(s,flags.run,flags.judgment && resolve(flags.judgment));}
184
- else if(event==='retry') {const s=src();if(captured && !flags.run && !flags.rejudge && !flags.launch && !flags['adopt-home']) retainedRun(s);result=retry(s,{run:flags.run,rejudge:!!flags.rejudge,launch:!!flags.launch,adoptHome:flags['adopt-home']});}
185
- else if(event==='inspect') result=consultOnly?inspectConsultOnly(consultSource(home)):inspect(src());
186
- else if(event==='setup' && flags.harvest!==undefined) {
187
- if(flags.source || flags.enable || flags.disable || flags['install-host']) fail('E_USAGE','setup --harvest takes no other setup flag');
188
- result=setupHarvest(flags.harvest);
189
- }
190
- else if(event==='setup') {
191
- const s=src();if(flags.enable && flags.disable) fail('E_USAGE','choose enable or disable');
192
- scheduleSource(s);
193
- if(flags.enable || flags.disable) {oats(['schedule',flags.enable?'enable':'disable',`okf-${s.id}`,'--dir',s.context,'--json'],s.context);updateStatus(s,current=>{current.auto=!!flags.enable;});}
194
- if(flags['install-host']) oats(['schedule','host','install','--dir',s.context,'--json'],s.context);
195
- result={source:s.file,scheduler:oats(['schedule','list','--dir',s.context,'--json'],s.context).scheduler};
196
- } else if(event==='init') result=initBase(loadBindings(),flags.base,flags.nodes,flags.output,{confirm:!!flags.confirm});
197
- else if(event==='migrate') {
198
- if(flags['source-home']) result=migrateSource(loadBindings(),flags['source-home']);
199
- else if(flags.forget) result=forgetMigration(loadBindings(),flags.forget);
200
- else if(flags.deliver) result=deliverMigration(resolve(flags.deliver));
201
- else if(flags.cutover) result=cutoverMigration(resolve(flags.cutover),flags['soul-dir']);
202
- else result=migrate(loadBindings(),{legacy:flags.legacy,alias:flags.base,node:flags.node,output:flags.output});
203
- } else if(event==='unlock') result=unlock(resolve(flags.lock),flags.token);
204
- else fail('E_USAGE',`unknown command ${event}; see --help`);
205
- answer=hook?result:{schemaVersion:1,ok:true,result};
206
- } catch(e) {const code=e.code || 'E_OKF',message=redactUrls(e.message);exit=1;answer=hook?{meta:{...(event==='retire'?{retired:false,reason:message}:{})},warning:`oats-okf ${code}: ${message}`}:{schemaVersion:1,ok:false,error:{code,message}};}
207
- // Consult commands print text unless --json; every other answer is JSON.
208
- // Let Node drain the pipe; no process.exit after a possibly large answer.
209
- if(textMode && exit) process.stderr.write(`oats okf ${event}: ${answer.error.code}: ${answer.error.message}\n`);
210
- else if(textMode) process.stdout.write(text+'\n');
211
- else process.stdout.write(JSON.stringify(answer)+'\n');
212
- process.exitCode=exit;
213
- }
@@ -1,42 +0,0 @@
1
- ## Knowledge: OKF
2
-
3
- You have two kinds of knowledge. Work WITH both: consult them at the start of
4
- every task, after compaction, and every so often while you work, to decide,
5
- to situate the task and to stay coherent with what your soul already knows.
6
-
7
- - **Soul knowledge**: your soul's accepted OKF bases, external to the soul and
8
- read remotely at their accepted state (there is no local copy).
9
- **Consultation** reads them with the `oats okf` CLI from your instance home.
10
- Load the **okf-consultation** skill at the start of every task.
11
- - **Instance knowledge**: this instance's own STATE.md, log.md and notes/ in
12
- instance home. Load the **okf-instance-knowledge** skill: it teaches what is
13
- worth capturing, not only where to put it.
14
-
15
- The work mode:
16
- - **At task start and after compaction:** read STATE.md, recent log.md
17
- entries and the relevant notes/, then `oats okf index` and
18
- `oats okf cat --base ALIAS PATH` for the concepts the task needs. Follow
19
- links; do not bulk-load.
20
- - **Before compaction and before a task boundary:** update STATE.md, log.md
21
- and notes/ first, so your future self can continue.
22
- - **Every so often while working, and always before a design decision or
23
- before re-deriving something:** `oats okf search` / `cat` the relevant
24
- concepts and re-read your own notes. Consult prior decisions before
25
- re-deriving them.
26
- - Cite what you relied on as `alias/node/concept.md@<short-oid>`. A Git PR is
27
- not accepted knowledge until it is merged. Report missing configuration or
28
- blocked reads; do not create a substitute.
29
-
30
- **Capture with judgment**, as it happens: decisions and why, rejected
31
- alternatives, costly discoveries, limitations and the workaround that worked,
32
- conclusions, blockers, human direction and corrections, and surprises that
33
- contradict soul knowledge (flag those as candidate supersessions). Not code
34
- descriptions, command logs, retries, secrets, verbatim third-party messages,
35
- or what the tracker and docs already hold. One concept per note in notes/;
36
- STATE.md is the current picture (rewritten); log.md is dated events
37
- (append-only). The knowledge harvester, not you, decides what is promoted.
38
-
39
- **Never write accepted knowledge or soul knowledge.** This is an instruction
40
- boundary, not a filesystem sandbox. Skills remain curated soul artifacts.
41
- Instance knowledge lives in instance home, not ./work; code and repository
42
- documentation remain the truth about code.