sneakoscope 4.8.4 → 4.8.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.
Files changed (81) hide show
  1. package/README.md +3 -3
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/bin/sks.js +1 -1
  6. package/dist/cli/command-registry.js +1 -0
  7. package/dist/core/agents/agent-central-ledger.js +10 -5
  8. package/dist/core/agents/agent-orchestrator.js +22 -1
  9. package/dist/core/agents/agent-runner-codex-exec.js +24 -0
  10. package/dist/core/agents/fast-mode-policy.js +3 -4
  11. package/dist/core/agents/native-cli-session-proof.js +1 -1
  12. package/dist/core/agents/native-cli-worker.js +73 -113
  13. package/dist/core/agents/worker-pane-communication-contract.js +2 -3
  14. package/dist/core/codex/codex-cli-syntax-builder.js +2 -0
  15. package/dist/core/codex-app/codex-init-deep.js +10 -3
  16. package/dist/core/codex-control/codex-reliability-shield.js +36 -17
  17. package/dist/core/codex-control/codex-sdk-adapter.js +2 -2
  18. package/dist/core/codex-control/codex-sdk-config-policy.js +4 -0
  19. package/dist/core/codex-control/codex-task-runner.js +23 -11
  20. package/dist/core/codex-native/core-skill-manifest.js +2 -1
  21. package/dist/core/commands/gates-command.js +58 -0
  22. package/dist/core/commands/release-command.js +5 -5
  23. package/dist/core/commands/stop-gate-command.js +1 -1
  24. package/dist/core/fsx.js +1 -1
  25. package/dist/core/hooks-runtime/team-digest.js +86 -0
  26. package/dist/core/hooks-runtime.js +1 -82
  27. package/dist/core/init/skills.js +395 -0
  28. package/dist/core/init.js +2 -376
  29. package/dist/core/lean-engineering-policy.js +2 -1
  30. package/dist/core/naruto/naruto-active-pool.js +36 -7
  31. package/dist/core/naruto/naruto-real-worker-child.js +67 -11
  32. package/dist/core/permission-gates.js +45 -19
  33. package/dist/core/pipeline-internals/runtime-gates.js +26 -45
  34. package/dist/core/ppt/artifacts.js +19 -0
  35. package/dist/core/ppt/html.js +96 -0
  36. package/dist/core/ppt/style-tokens.js +248 -0
  37. package/dist/core/ppt.js +6 -352
  38. package/dist/core/qa-loop/{qa-contract-v2.js → qa-contract.js} +1 -1
  39. package/dist/core/qa-loop/{qa-gate-v2.js → qa-gate.js} +1 -1
  40. package/dist/core/qa-loop/qa-runtime-artifacts.js +2 -2
  41. package/dist/core/qa-loop.js +11 -4
  42. package/dist/core/recallpulse/policy.js +226 -0
  43. package/dist/core/recallpulse.js +2 -225
  44. package/dist/core/release/release-gate-dag.js +6 -2
  45. package/dist/core/research/mock-result.js +406 -0
  46. package/dist/core/research/prompt.js +15 -0
  47. package/dist/core/research.js +2 -402
  48. package/dist/core/routes/constants.js +48 -0
  49. package/dist/core/routes/design-policy.js +37 -0
  50. package/dist/core/routes/evidence.js +77 -0
  51. package/dist/core/routes/ppt-policy.js +26 -0
  52. package/dist/core/routes.js +8 -179
  53. package/dist/core/safety/mutation-ledger.js +2 -0
  54. package/dist/core/safety/ssot-guard.js +2 -2
  55. package/dist/core/stop-gate/stop-gate-check.js +10 -17
  56. package/dist/core/version.js +1 -1
  57. package/dist/core/zellij/zellij-slot-pane-renderer.js +15 -8
  58. package/dist/core/zellij/zellij-slot-telemetry.js +28 -12
  59. package/dist/scripts/check-pipeline-budget.js +1 -7
  60. package/dist/scripts/check-pipeline-runtime.js +1 -8
  61. package/dist/scripts/codex-control-all-pipelines-check.js +5 -14
  62. package/dist/scripts/codex-sdk-all-pipelines-check.js +5 -9
  63. package/dist/scripts/fast-codex-service-tier-proof-check.js +2 -2
  64. package/dist/scripts/gate-policy-audit-check.js +70 -0
  65. package/dist/scripts/official-docs-compat-report.js +2 -2
  66. package/dist/scripts/product-design-plugin-routing-check.js +10 -5
  67. package/dist/scripts/qa-loop-surface-router-check.js +2 -2
  68. package/dist/scripts/release-check-dynamic-execute.js +32 -35
  69. package/dist/scripts/release-check-dynamic.js +19 -28
  70. package/dist/scripts/release-check-stamp.js +2 -2
  71. package/dist/scripts/release-dag-full-coverage-check.js +57 -394
  72. package/dist/scripts/release-dynamic-performance-check.js +18 -19
  73. package/dist/scripts/release-dynamic-presets-check.js +2 -2
  74. package/dist/scripts/release-gate-dag-runner.js +3 -1
  75. package/dist/scripts/release-gate-existence-audit.js +59 -91
  76. package/dist/scripts/release-gate-planner.js +43 -23
  77. package/dist/scripts/release-metadata-1-19-check.js +100 -12
  78. package/dist/scripts/worker-pane-communication-contract-check.js +1 -2
  79. package/dist/scripts/zellij-slot-pane-renderer-check.js +3 -2
  80. package/package.json +13 -965
  81. package/dist/core/pipeline-runtime.js +0 -2
@@ -6,7 +6,7 @@ import { resolveCodexAppExecutionProfile } from './codex-app/codex-app-execution
6
6
  import { resolveCodexNativeInvocationPlan } from './codex-native/codex-native-invocation-router.js';
7
7
  import { imageDimensions, sha256File } from './wiki-image/image-hash.js';
8
8
  import { initializeQaRuntimeArtifacts } from './qa-loop/qa-runtime-artifacts.js';
9
- import { evaluateQaGateV2 } from './qa-loop/qa-gate-v2.js';
9
+ import { evaluateQaGateV2 } from './qa-loop/qa-gate.js';
10
10
  import { DEFAULT_QA_MAX_CYCLES, QA_GATE_V2_ARTIFACT, QA_SURFACE_SELECTION_ARTIFACT } from './qa-loop/qa-types.js';
11
11
  export const QA_LOOP_ROUTE = 'QALoop';
12
12
  export const QA_LOOP_VISUAL_EVIDENCE_ARTIFACT = 'qa-loop/visual-evidence.json';
@@ -483,10 +483,16 @@ export async function evaluateQaGate(dir) {
483
483
  const reasons = [];
484
484
  if (gateV2 && gateV2.passed !== true)
485
485
  reasons.push(...(gateV2.blockers || []));
486
- for (const key of ['clarification_contract_sealed', 'qa_report_written', 'qa_ledger_complete', 'checklist_completed', 'safety_reviewed', 'deployed_destructive_tests_blocked', 'credentials_not_persisted', 'honest_mode_complete']) {
486
+ const verificationLevel = String(gate.verification_level || 'real');
487
+ const mockVerification = verificationLevel === 'mock';
488
+ const uiEvidenceClaimed = gate.ui_e2e_required === true || gate.ui_chrome_extension_evidence === true || gate.ui_computer_use_evidence === true || gate.ui_evidence_claimed === true;
489
+ const apiEvidenceClaimed = gate.api_e2e_required === true || gate.api_evidence_claimed === true;
490
+ for (const key of ['clarification_contract_sealed', 'qa_report_written', 'qa_ledger_complete', 'checklist_completed', 'safety_reviewed', 'deployed_destructive_tests_blocked', 'credentials_not_persisted']) {
487
491
  if (gate[key] !== true)
488
492
  reasons.push(`${key}_missing`);
489
493
  }
494
+ if (!mockVerification && (uiEvidenceClaimed || apiEvidenceClaimed) && gate.honest_mode_complete !== true)
495
+ reasons.push('honest_mode_complete_missing');
490
496
  if (gate.corrective_loop_enabled === true) {
491
497
  if (gate.safe_remediation_required !== true)
492
498
  reasons.push('safe_remediation_required_missing');
@@ -547,7 +553,7 @@ export async function evaluateQaGate(dir) {
547
553
  reasons.push('qa_ledger_missing');
548
554
  const uniqueReasons = [...new Set(reasons)];
549
555
  const passed = gate.passed === true && uniqueReasons.length === 0;
550
- const result = { checked_at: nowIso(), passed, reasons: uniqueReasons, gate, gate_v2: gateV2 };
556
+ const result = { checked_at: nowIso(), passed, verification_level: verificationLevel, reasons: uniqueReasons, gate, gate_v2: gateV2 };
551
557
  await writeJsonAtomic(path.join(dir, 'qa-gate.evaluated.json'), result);
552
558
  return result;
553
559
  }
@@ -576,6 +582,7 @@ export async function writeMockQaResult(dir, mission, contract) {
576
582
  codex_app_agent_role_strategy: previousGate.codex_app_agent_role_strategy || null,
577
583
  codex_native_invocation: previousGate.codex_native_invocation || null,
578
584
  blockers: previousGate.blockers || [],
585
+ verification_level: 'mock',
579
586
  passed: !uiRequired,
580
587
  qa_report_written: true,
581
588
  qa_ledger_complete: true,
@@ -590,7 +597,7 @@ export async function writeMockQaResult(dir, mission, contract) {
590
597
  unresolved_fixable_findings: 0,
591
598
  unsafe_or_deferred_findings: 0,
592
599
  post_fix_verification_complete: true,
593
- honest_mode_complete: true,
600
+ honest_mode_complete: false,
594
601
  evidence: ['mock QA-LOOP smoke completed'],
595
602
  notes: ['No live UI/API verification was claimed.']
596
603
  });
@@ -0,0 +1,226 @@
1
+ export const RECALLPULSE_DECISION_ARTIFACT = 'recallpulse-decision.json';
2
+ export const RECALLPULSE_HISTORY_ARTIFACT = 'recallpulse-history.jsonl';
3
+ export const MISSION_STATUS_LEDGER_ARTIFACT = 'mission-status-ledger.json';
4
+ export const MISSION_STATUS_HISTORY_ARTIFACT = 'mission-status-history.jsonl';
5
+ export const ROUTE_PROOF_CAPSULE_ARTIFACT = 'route-proof-capsule.json';
6
+ export const EVIDENCE_ENVELOPE_ARTIFACT = 'evidence-envelope.json';
7
+ export const RECALLPULSE_EVAL_ARTIFACT = 'recallpulse-eval-report.json';
8
+ export const RECALLPULSE_GOVERNANCE_ARTIFACT = 'recallpulse-governance-report.json';
9
+ export const RECALLPULSE_TASK_GOAL_LEDGER_ARTIFACT = 'recallpulse-task-goal-ledger.json';
10
+ export const RECALLPULSE_TASKS_FILE = 'docs/RECALLPULSE_0_8_0_TASKS.md';
11
+ export const RECALLPULSE_POLICY = Object.freeze({
12
+ schema_version: 1,
13
+ name: 'RecallPulse',
14
+ mode: 'report_only',
15
+ internal_origin: 'strong_reminder_intent',
16
+ user_visible_language: 'neutral_positive_recall',
17
+ profanity_policy: 'never_repeat_profane_origin_as_active_user_visible_prompt_text',
18
+ first_milestone_done_when: [
19
+ 'report_only_decisions_written',
20
+ 'TriWiki_L1_L2_L3_decision_recorded',
21
+ 'durable_status_ledger_available',
22
+ 'duplicate_suppression_keys_recorded',
23
+ 'route_proof_capsule_written',
24
+ 'evidence_envelope_written',
25
+ 'eval_fixtures_pass',
26
+ 'existing_route_gates_remain_authoritative'
27
+ ],
28
+ stage_boundaries: {
29
+ required: ['route_intake', 'before_planning', 'before_implementation', 'before_review', 'before_final'],
30
+ optional: ['after_blocker_discovery', 'after_subagent_result', 'after_context7_evidence', 'after_db_safety_findings', 'after_failed_verification']
31
+ },
32
+ invariants: [
33
+ 'route_personalities_remain_owned_by_route_skills',
34
+ 'shared_recall_mechanics_live_in_one_common_spine',
35
+ 'cannot_bypass_db_safety',
36
+ 'cannot_bypass_visual_evidence_requirements',
37
+ 'cannot_replace_honest_mode',
38
+ 'cannot_replace_triwiki_validation_before_final',
39
+ 'cannot_introduce_unrequested_fallback_code',
40
+ 'record_uncertainty_for_stale_or_low_trust_memory',
41
+ 'prefer_current_source_evidence_over_old_memory',
42
+ 'distinguish_facts_inferences_hypotheses_and_tasks',
43
+ 'never_turn_alerting_into_repeated_nagging',
44
+ 'durable_state_beats_ephemeral_hook_text'
45
+ ],
46
+ no_regression: [
47
+ 'existing_route_gates',
48
+ 'generated_skill_installation',
49
+ 'codex_app_stop_hooks',
50
+ 'dfix_ultralight_behavior',
51
+ 'team_minimum_five_lane_review',
52
+ 'research_xhigh_agent_requirements',
53
+ 'db_destructive_operation_blocking',
54
+ 'imagegen_evidence_requirements'
55
+ ],
56
+ cache: {
57
+ l1: {
58
+ label: 'TriWiki L1',
59
+ purpose: 'smallest active recall slice for the current stage',
60
+ max_items_normal: 4,
61
+ max_items_final: 6,
62
+ max_tokens: 900,
63
+ min_trust: 0.8,
64
+ eligibility: ['trust_score', 'freshness', 'route_relevance', 'risk'],
65
+ exclude: ['stale', 'conflicted', 'unsupported', 'low_confidence'],
66
+ phrasing: 'positive_recall_only',
67
+ reminder_style: 'short_remember_to_check_without_blame_language'
68
+ },
69
+ l2: {
70
+ label: 'TriWiki L2',
71
+ purpose: 'mission-local proof and execution memory',
72
+ includes: ['route_context', 'decision_contract', 'gate_blockers', 'verification_results', 'subagent_handoffs', 'status_ledger_snapshot', 'route_artifacts', 'evidence_hashes', 'duplicate_keys', 'deduped_failed_recall']
73
+ },
74
+ l3: {
75
+ label: 'TriWiki L3',
76
+ purpose: 'source hydration from full TriWiki, ledgers, docs, and local code',
77
+ triggers: ['stale_memory', 'low_trust_memory', 'source_conflict', 'final_claim', 'db_security_release', 'external_package_api', 'broad_route_policy', 'legacy_or_ignored_pack']
78
+ },
79
+ transitions: {
80
+ promote_l3_to_l2: 'source_backed_claim_used_in_current_mission',
81
+ promote_l2_to_l1: 'claim_immediately_stage_critical',
82
+ demote_l1: 'claim_consumed_or_stage_changed',
83
+ demote_l2: 'mission_phase_ended',
84
+ demote_l3_candidate: 'stale_or_contradicted'
85
+ },
86
+ eviction: ['token_cost', 'duplicate_count', 'low_route_relevance', 'old_mission_scope', 'nice_to_know'],
87
+ pinning: ['hard_safety_rules', 'user_acceptance_criteria', 'current_blockers', 'pending_verification_failures', 'release_version_facts']
88
+ },
89
+ actions: {
90
+ cache_hit: 'enough_fresh_context_available',
91
+ hydrate: 'source_or_l3_evidence_needed_before_proceeding',
92
+ suppress: 'message_or_reminder_already_surfaced',
93
+ escalate: 'route_must_use_heavier_gate_or_review_path',
94
+ block: 'continuing_would_violate_policy_or_evidence_requirements',
95
+ no_op: 'no_recall_relevant_item_for_stage'
96
+ },
97
+ input_contracts: ['stage_boundary', 'route_metadata', 'triwiki_attention', 'mission_artifact_freshness', 'hook_event', 'verification_result', 'user_message_context'],
98
+ scoring: {
99
+ deterministic: true,
100
+ inputs: ['trust_score', 'freshness', 'route_relevance', 'risk', 'stage_id', 'route_id', 'artifact_freshness', 'duplicate_key'],
101
+ weights: {
102
+ trust_score: 0.32,
103
+ route_relevance: 0.24,
104
+ risk: 0.18,
105
+ freshness: 0.14,
106
+ stage_criticality: 0.08,
107
+ duplicate_penalty: -0.12
108
+ }
109
+ },
110
+ thresholds: {
111
+ l1_default: 0.72,
112
+ l1_final_claim: 0.84,
113
+ db_security_release: 0.9,
114
+ min_evidence_for_completion_claim: 1
115
+ },
116
+ invalid_context_pack_policy: {
117
+ missing_pack: 'hydrate_and_report_only_no_behavior_change',
118
+ coordinate_only_legacy_pack: 'hydrate_l3_and_require_refresh_before_final_claim',
119
+ failed_wiki_validation: 'block_final_claim_until_validate_passes',
120
+ stale_mission_id: 'bind_to_explicit_mission_id_or_report_latest_drift',
121
+ subagent_child_mission: 'record_child_mission_handoff_in_l2_and_keep_parent_mission_binding',
122
+ latest_mission_drift: 'resolve_latest_once_then_write_explicit_mission_id_into_artifacts',
123
+ graduation: 'report_only_to_enforcement_only_after_shadow_eval_targets_pass'
124
+ },
125
+ status_ledger: {
126
+ artifact: MISSION_STATUS_LEDGER_ARTIFACT,
127
+ history_artifact: MISSION_STATUS_HISTORY_ARTIFACT,
128
+ max_entries: 200,
129
+ append_only_history: true,
130
+ compacted_current_view: true,
131
+ categories: ['info', 'progress', 'warning', 'blocker', 'verification', 'final'],
132
+ audiences: ['user', 'route', 'reviewer', 'final-summary'],
133
+ rule: 'hooks may point to ledger entries but must not be the only durable source'
134
+ },
135
+ repetition: {
136
+ key_fields: ['route_id', 'mission_id', 'stage_id', 'claim_hash', 'evidence_hash', 'blocker_code', 'visible_message_hash'],
137
+ repeat_budget: {
138
+ route_stage: 2,
139
+ finalization_hook: 2,
140
+ blocker: 2,
141
+ missing_artifact: 2
142
+ },
143
+ max_visible_repeat_count: 1,
144
+ hidden_diagnostic_repeat_count: 20,
145
+ cooldown_ms: 10 * 60 * 1000,
146
+ reset_on: ['new_evidence', 'blocker_resolved', 'route_stage_changed'],
147
+ no_reset_on: ['cosmetic_rewording', 'identical_missing_gate_artifact'],
148
+ conversions: {
149
+ duplicate_info_message: 'suppress_visible_repeat_and_keep_durable_status_row',
150
+ repeated_blocker: 'escalate_to_route_gate_or_hard_blocker_when_no_progress_occurs',
151
+ repeated_warning: 'convert_to_single_blocker_or_checklist_item_when_actionable',
152
+ repeated_remember_message: 'convert_to_one_child_goal_checklist_item',
153
+ repeated_hook_output: 'collapse_into_mission_status_ledger_summary'
154
+ },
155
+ telemetry: ['repeat_count', 'suppressed_count', 'cooldown_resets', 'alert_fatigue_proxy', 'message_useful_proxy', 'message_ignored_proxy'],
156
+ regression_tests: ['duplicate_stop_hook_summary_collapses_to_status_ledger']
157
+ },
158
+ eval_targets: {
159
+ required_recall_rate: 0.95,
160
+ false_positive_hydration_rate_max: 0.2,
161
+ duplicate_message_reduction_min: 0.5,
162
+ token_cost_reduction_min: 0.05,
163
+ route_gate_agreement_min: 0.98,
164
+ critical_safety_regressions: 0,
165
+ failed_selftest_increase: 0,
166
+ route_completion_blocker_increase: 0,
167
+ user_visible_confusion_report_increase: 0,
168
+ unsupported_performance_claims: 0
169
+ },
170
+ route_registry_fields: ['shared_spine_enabled', 'recallpulse_stage_policy', 'status_projection_policy', 'repetition_budget', 'evidence_envelope_extensions', 'proof_capsule_extensions', 'persona_policy', 'release_notes_label'],
171
+ feature_flag: 'SKS_RECALLPULSE_MODE',
172
+ rollback: 'set SKS_RECALLPULSE_MODE=off or leave report_only unpromoted'
173
+ });
174
+ export const RESEARCH_AGENT_PERSONA_CONTRACT = Object.freeze([
175
+ {
176
+ id: 'einstein',
177
+ display_name: 'Einstein Agent',
178
+ historical_inspiration: 'Albert Einstein',
179
+ persona: 'first-principles reframer',
180
+ role: 'first_principles_reframer',
181
+ mandate: 'Strip assumptions, identify invariants, and build decisive thought experiments.',
182
+ required_outputs: ['eureka_moment', 'assumptions_removed', 'invariant_or_simplifying_frame', 'decisive_thought_experiment']
183
+ },
184
+ {
185
+ id: 'feynman',
186
+ display_name: 'Feynman Agent',
187
+ historical_inspiration: 'Richard Feynman',
188
+ persona: 'explanation experimentalist',
189
+ role: 'explanation_experimentalist',
190
+ mandate: 'Make the idea teachable, testable, and hard to hide behind jargon.',
191
+ required_outputs: ['eureka_moment', 'plain_language_mechanism', 'toy_model', 'cheap_empirical_probe']
192
+ },
193
+ {
194
+ id: 'turing',
195
+ display_name: 'Turing Agent',
196
+ historical_inspiration: 'Alan Turing',
197
+ persona: 'formalization and adversarial cases',
198
+ role: 'formalization_and_adversarial_cases',
199
+ mandate: 'Formalize inputs, outputs, algorithms, limits, and countercases.',
200
+ required_outputs: ['eureka_moment', 'formal_definition', 'algorithmic_shape', 'adversarial_case']
201
+ },
202
+ {
203
+ id: 'von_neumann',
204
+ display_name: 'von Neumann Agent',
205
+ historical_inspiration: 'John von Neumann',
206
+ persona: 'systems strategy agent',
207
+ role: 'systems_strategy_agent',
208
+ mandate: 'Map system dynamics, scaling behavior, incentives, and worst-case interactions.',
209
+ required_outputs: ['eureka_moment', 'system_model', 'scaling_risk', 'robustness_condition']
210
+ },
211
+ {
212
+ id: 'skeptic',
213
+ display_name: 'Skeptic Agent',
214
+ historical_inspiration: 'counterevidence discipline',
215
+ persona: 'counterevidence agent',
216
+ role: 'counterevidence_agent',
217
+ mandate: 'Attack the strongest surviving claim with counterevidence and base-rate failures.',
218
+ required_outputs: ['eureka_moment', 'counterevidence', 'base_rate_failure_mode', 'claim_to_downgrade']
219
+ }
220
+ ].map((agent) => Object.freeze({
221
+ ...agent,
222
+ persona_boundary: 'persona-inspired cognitive lens only; do not impersonate the historical person',
223
+ reasoning_effort: 'xhigh',
224
+ service_tier: 'fast'
225
+ })));
226
+ //# sourceMappingURL=policy.js.map
@@ -3,231 +3,8 @@ import path from 'node:path';
3
3
  import { appendJsonlBounded, exists, nowIso, readJson, readText, sha256, writeJsonAtomic, writeTextAtomic } from './fsx.js';
4
4
  import { missionDir } from './mission.js';
5
5
  import { ROUTES } from './routes.js';
6
- export const RECALLPULSE_DECISION_ARTIFACT = 'recallpulse-decision.json';
7
- export const RECALLPULSE_HISTORY_ARTIFACT = 'recallpulse-history.jsonl';
8
- export const MISSION_STATUS_LEDGER_ARTIFACT = 'mission-status-ledger.json';
9
- export const MISSION_STATUS_HISTORY_ARTIFACT = 'mission-status-history.jsonl';
10
- export const ROUTE_PROOF_CAPSULE_ARTIFACT = 'route-proof-capsule.json';
11
- export const EVIDENCE_ENVELOPE_ARTIFACT = 'evidence-envelope.json';
12
- export const RECALLPULSE_EVAL_ARTIFACT = 'recallpulse-eval-report.json';
13
- export const RECALLPULSE_GOVERNANCE_ARTIFACT = 'recallpulse-governance-report.json';
14
- export const RECALLPULSE_TASK_GOAL_LEDGER_ARTIFACT = 'recallpulse-task-goal-ledger.json';
15
- export const RECALLPULSE_TASKS_FILE = 'docs/RECALLPULSE_0_8_0_TASKS.md';
16
- export const RECALLPULSE_POLICY = Object.freeze({
17
- schema_version: 1,
18
- name: 'RecallPulse',
19
- mode: 'report_only',
20
- internal_origin: 'strong_reminder_intent',
21
- user_visible_language: 'neutral_positive_recall',
22
- profanity_policy: 'never_repeat_profane_origin_as_active_user_visible_prompt_text',
23
- first_milestone_done_when: [
24
- 'report_only_decisions_written',
25
- 'TriWiki_L1_L2_L3_decision_recorded',
26
- 'durable_status_ledger_available',
27
- 'duplicate_suppression_keys_recorded',
28
- 'route_proof_capsule_written',
29
- 'evidence_envelope_written',
30
- 'eval_fixtures_pass',
31
- 'existing_route_gates_remain_authoritative'
32
- ],
33
- stage_boundaries: {
34
- required: ['route_intake', 'before_planning', 'before_implementation', 'before_review', 'before_final'],
35
- optional: ['after_blocker_discovery', 'after_subagent_result', 'after_context7_evidence', 'after_db_safety_findings', 'after_failed_verification']
36
- },
37
- invariants: [
38
- 'route_personalities_remain_owned_by_route_skills',
39
- 'shared_recall_mechanics_live_in_one_common_spine',
40
- 'cannot_bypass_db_safety',
41
- 'cannot_bypass_visual_evidence_requirements',
42
- 'cannot_replace_honest_mode',
43
- 'cannot_replace_triwiki_validation_before_final',
44
- 'cannot_introduce_unrequested_fallback_code',
45
- 'record_uncertainty_for_stale_or_low_trust_memory',
46
- 'prefer_current_source_evidence_over_old_memory',
47
- 'distinguish_facts_inferences_hypotheses_and_tasks',
48
- 'never_turn_alerting_into_repeated_nagging',
49
- 'durable_state_beats_ephemeral_hook_text'
50
- ],
51
- no_regression: [
52
- 'existing_route_gates',
53
- 'generated_skill_installation',
54
- 'codex_app_stop_hooks',
55
- 'dfix_ultralight_behavior',
56
- 'team_minimum_five_lane_review',
57
- 'research_xhigh_agent_requirements',
58
- 'db_destructive_operation_blocking',
59
- 'imagegen_evidence_requirements'
60
- ],
61
- cache: {
62
- l1: {
63
- label: 'TriWiki L1',
64
- purpose: 'smallest active recall slice for the current stage',
65
- max_items_normal: 4,
66
- max_items_final: 6,
67
- max_tokens: 900,
68
- min_trust: 0.8,
69
- eligibility: ['trust_score', 'freshness', 'route_relevance', 'risk'],
70
- exclude: ['stale', 'conflicted', 'unsupported', 'low_confidence'],
71
- phrasing: 'positive_recall_only',
72
- reminder_style: 'short_remember_to_check_without_blame_language'
73
- },
74
- l2: {
75
- label: 'TriWiki L2',
76
- purpose: 'mission-local proof and execution memory',
77
- includes: ['route_context', 'decision_contract', 'gate_blockers', 'verification_results', 'subagent_handoffs', 'status_ledger_snapshot', 'route_artifacts', 'evidence_hashes', 'duplicate_keys', 'deduped_failed_recall']
78
- },
79
- l3: {
80
- label: 'TriWiki L3',
81
- purpose: 'source hydration from full TriWiki, ledgers, docs, and local code',
82
- triggers: ['stale_memory', 'low_trust_memory', 'source_conflict', 'final_claim', 'db_security_release', 'external_package_api', 'broad_route_policy', 'legacy_or_ignored_pack']
83
- },
84
- transitions: {
85
- promote_l3_to_l2: 'source_backed_claim_used_in_current_mission',
86
- promote_l2_to_l1: 'claim_immediately_stage_critical',
87
- demote_l1: 'claim_consumed_or_stage_changed',
88
- demote_l2: 'mission_phase_ended',
89
- demote_l3_candidate: 'stale_or_contradicted'
90
- },
91
- eviction: ['token_cost', 'duplicate_count', 'low_route_relevance', 'old_mission_scope', 'nice_to_know'],
92
- pinning: ['hard_safety_rules', 'user_acceptance_criteria', 'current_blockers', 'pending_verification_failures', 'release_version_facts']
93
- },
94
- actions: {
95
- cache_hit: 'enough_fresh_context_available',
96
- hydrate: 'source_or_l3_evidence_needed_before_proceeding',
97
- suppress: 'message_or_reminder_already_surfaced',
98
- escalate: 'route_must_use_heavier_gate_or_review_path',
99
- block: 'continuing_would_violate_policy_or_evidence_requirements',
100
- no_op: 'no_recall_relevant_item_for_stage'
101
- },
102
- input_contracts: ['stage_boundary', 'route_metadata', 'triwiki_attention', 'mission_artifact_freshness', 'hook_event', 'verification_result', 'user_message_context'],
103
- scoring: {
104
- deterministic: true,
105
- inputs: ['trust_score', 'freshness', 'route_relevance', 'risk', 'stage_id', 'route_id', 'artifact_freshness', 'duplicate_key'],
106
- weights: {
107
- trust_score: 0.32,
108
- route_relevance: 0.24,
109
- risk: 0.18,
110
- freshness: 0.14,
111
- stage_criticality: 0.08,
112
- duplicate_penalty: -0.12
113
- }
114
- },
115
- thresholds: {
116
- l1_default: 0.72,
117
- l1_final_claim: 0.84,
118
- db_security_release: 0.9,
119
- min_evidence_for_completion_claim: 1
120
- },
121
- invalid_context_pack_policy: {
122
- missing_pack: 'hydrate_and_report_only_no_behavior_change',
123
- coordinate_only_legacy_pack: 'hydrate_l3_and_require_refresh_before_final_claim',
124
- failed_wiki_validation: 'block_final_claim_until_validate_passes',
125
- stale_mission_id: 'bind_to_explicit_mission_id_or_report_latest_drift',
126
- subagent_child_mission: 'record_child_mission_handoff_in_l2_and_keep_parent_mission_binding',
127
- latest_mission_drift: 'resolve_latest_once_then_write_explicit_mission_id_into_artifacts',
128
- graduation: 'report_only_to_enforcement_only_after_shadow_eval_targets_pass'
129
- },
130
- status_ledger: {
131
- artifact: MISSION_STATUS_LEDGER_ARTIFACT,
132
- history_artifact: MISSION_STATUS_HISTORY_ARTIFACT,
133
- max_entries: 200,
134
- append_only_history: true,
135
- compacted_current_view: true,
136
- categories: ['info', 'progress', 'warning', 'blocker', 'verification', 'final'],
137
- audiences: ['user', 'route', 'reviewer', 'final-summary'],
138
- rule: 'hooks may point to ledger entries but must not be the only durable source'
139
- },
140
- repetition: {
141
- key_fields: ['route_id', 'mission_id', 'stage_id', 'claim_hash', 'evidence_hash', 'blocker_code', 'visible_message_hash'],
142
- repeat_budget: {
143
- route_stage: 2,
144
- finalization_hook: 2,
145
- blocker: 2,
146
- missing_artifact: 2
147
- },
148
- max_visible_repeat_count: 1,
149
- hidden_diagnostic_repeat_count: 20,
150
- cooldown_ms: 10 * 60 * 1000,
151
- reset_on: ['new_evidence', 'blocker_resolved', 'route_stage_changed'],
152
- no_reset_on: ['cosmetic_rewording', 'identical_missing_gate_artifact'],
153
- conversions: {
154
- duplicate_info_message: 'suppress_visible_repeat_and_keep_durable_status_row',
155
- repeated_blocker: 'escalate_to_route_gate_or_hard_blocker_when_no_progress_occurs',
156
- repeated_warning: 'convert_to_single_blocker_or_checklist_item_when_actionable',
157
- repeated_remember_message: 'convert_to_one_child_goal_checklist_item',
158
- repeated_hook_output: 'collapse_into_mission_status_ledger_summary'
159
- },
160
- telemetry: ['repeat_count', 'suppressed_count', 'cooldown_resets', 'alert_fatigue_proxy', 'message_useful_proxy', 'message_ignored_proxy'],
161
- regression_tests: ['duplicate_stop_hook_summary_collapses_to_status_ledger']
162
- },
163
- eval_targets: {
164
- required_recall_rate: 0.95,
165
- false_positive_hydration_rate_max: 0.2,
166
- duplicate_message_reduction_min: 0.5,
167
- token_cost_reduction_min: 0.05,
168
- route_gate_agreement_min: 0.98,
169
- critical_safety_regressions: 0,
170
- failed_selftest_increase: 0,
171
- route_completion_blocker_increase: 0,
172
- user_visible_confusion_report_increase: 0,
173
- unsupported_performance_claims: 0
174
- },
175
- route_registry_fields: ['shared_spine_enabled', 'recallpulse_stage_policy', 'status_projection_policy', 'repetition_budget', 'evidence_envelope_extensions', 'proof_capsule_extensions', 'persona_policy', 'release_notes_label'],
176
- feature_flag: 'SKS_RECALLPULSE_MODE',
177
- rollback: 'set SKS_RECALLPULSE_MODE=off or leave report_only unpromoted'
178
- });
179
- export const RESEARCH_AGENT_PERSONA_CONTRACT = Object.freeze([
180
- {
181
- id: 'einstein',
182
- display_name: 'Einstein Agent',
183
- historical_inspiration: 'Albert Einstein',
184
- persona: 'first-principles reframer',
185
- role: 'first_principles_reframer',
186
- mandate: 'Strip assumptions, identify invariants, and build decisive thought experiments.',
187
- required_outputs: ['eureka_moment', 'assumptions_removed', 'invariant_or_simplifying_frame', 'decisive_thought_experiment']
188
- },
189
- {
190
- id: 'feynman',
191
- display_name: 'Feynman Agent',
192
- historical_inspiration: 'Richard Feynman',
193
- persona: 'explanation experimentalist',
194
- role: 'explanation_experimentalist',
195
- mandate: 'Make the idea teachable, testable, and hard to hide behind jargon.',
196
- required_outputs: ['eureka_moment', 'plain_language_mechanism', 'toy_model', 'cheap_empirical_probe']
197
- },
198
- {
199
- id: 'turing',
200
- display_name: 'Turing Agent',
201
- historical_inspiration: 'Alan Turing',
202
- persona: 'formalization and adversarial cases',
203
- role: 'formalization_and_adversarial_cases',
204
- mandate: 'Formalize inputs, outputs, algorithms, limits, and countercases.',
205
- required_outputs: ['eureka_moment', 'formal_definition', 'algorithmic_shape', 'adversarial_case']
206
- },
207
- {
208
- id: 'von_neumann',
209
- display_name: 'von Neumann Agent',
210
- historical_inspiration: 'John von Neumann',
211
- persona: 'systems strategy agent',
212
- role: 'systems_strategy_agent',
213
- mandate: 'Map system dynamics, scaling behavior, incentives, and worst-case interactions.',
214
- required_outputs: ['eureka_moment', 'system_model', 'scaling_risk', 'robustness_condition']
215
- },
216
- {
217
- id: 'skeptic',
218
- display_name: 'Skeptic Agent',
219
- historical_inspiration: 'counterevidence discipline',
220
- persona: 'counterevidence agent',
221
- role: 'counterevidence_agent',
222
- mandate: 'Attack the strongest surviving claim with counterevidence and base-rate failures.',
223
- required_outputs: ['eureka_moment', 'counterevidence', 'base_rate_failure_mode', 'claim_to_downgrade']
224
- }
225
- ].map((agent) => Object.freeze({
226
- ...agent,
227
- persona_boundary: 'persona-inspired cognitive lens only; do not impersonate the historical person',
228
- reasoning_effort: 'xhigh',
229
- service_tier: 'fast'
230
- })));
6
+ import { EVIDENCE_ENVELOPE_ARTIFACT, MISSION_STATUS_HISTORY_ARTIFACT, MISSION_STATUS_LEDGER_ARTIFACT, RECALLPULSE_DECISION_ARTIFACT, RECALLPULSE_EVAL_ARTIFACT, RECALLPULSE_GOVERNANCE_ARTIFACT, RECALLPULSE_HISTORY_ARTIFACT, RECALLPULSE_POLICY, RECALLPULSE_TASK_GOAL_LEDGER_ARTIFACT, RECALLPULSE_TASKS_FILE, RESEARCH_AGENT_PERSONA_CONTRACT, ROUTE_PROOF_CAPSULE_ARTIFACT } from './recallpulse/policy.js';
7
+ export { EVIDENCE_ENVELOPE_ARTIFACT, MISSION_STATUS_HISTORY_ARTIFACT, MISSION_STATUS_LEDGER_ARTIFACT, RECALLPULSE_DECISION_ARTIFACT, RECALLPULSE_EVAL_ARTIFACT, RECALLPULSE_GOVERNANCE_ARTIFACT, RECALLPULSE_HISTORY_ARTIFACT, RECALLPULSE_POLICY, RECALLPULSE_TASK_GOAL_LEDGER_ARTIFACT, RECALLPULSE_TASKS_FILE, RESEARCH_AGENT_PERSONA_CONTRACT, ROUTE_PROOF_CAPSULE_ARTIFACT } from './recallpulse/policy.js';
231
8
  export function recallPulseMissionDir(root, missionId) {
232
9
  if (!missionId)
233
10
  throw new Error('RecallPulse requires a mission id');
@@ -27,8 +27,12 @@ export async function runReleaseGateDag(input) {
27
27
  const root = path.resolve(input.root);
28
28
  const preset = input.preset || 'release';
29
29
  const manifest = loadReleaseGateManifest(root);
30
- const presetGates = selectReleaseGatePreset(manifest, preset);
31
- const affected = (preset === 'affected' || preset === 'fast' || preset === 'confidence') && input.full !== true
30
+ const onlyGateIds = new Set((input.onlyGateIds || []).map(String).filter(Boolean));
31
+ const presetGates = onlyGateIds.size
32
+ ? manifest.gates.filter((gate) => onlyGateIds.has(gate.id))
33
+ : selectReleaseGatePreset(manifest, preset);
34
+ const forceFullSelection = input.full === true || onlyGateIds.size > 0;
35
+ const affected = (preset === 'affected' || preset === 'fast' || preset === 'confidence') && !forceFullSelection
32
36
  ? selectAffectedReleaseGates(root, manifest, presetGates, { changedSince: input.changedSince || 'auto', ...(input.changedFiles ? { changedFiles: input.changedFiles } : {}), preset })
33
37
  : selectAffectedReleaseGates(root, manifest, presetGates, { full: true, preset });
34
38
  const rootReleaseSurfaceChanged = affected.selection.changed_files.some((file) => file === 'package.json' || file === 'package-lock.json' || file === 'release-gates.v2.json');