kenaz 0.3.22 → 0.3.24
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/core/.claude/hooks/_user-scope.js +1 -1
- package/core/.claude/hooks/core-resolve.js +1 -1
- package/core/.claude/hooks/worktree-create.js +11 -29
- package/core/.claude/hooks/worktree-remove.js +12 -38
- package/core/.collaboration/core/reconcile.js +16 -1
- package/core/.collaboration/core/task-2467-lifecycle.test.js +63 -0
- package/core/.collaboration/core/task-api.js +37 -7
- package/core/.formation/bifrost/launch.js +1 -1
- package/core/.formation/tools/dispatch-detail/worktree-subagent-mode.md +6 -1
- package/core/.formation/tools/kenaz-stats.js +1 -1
- package/core/.formation/tools/post-complete/git-merge.js +1 -1
- package/core/.formation/tools/prompt.js +1 -1
- package/core/.formation/tools/utils.js +5 -5
- package/core/.formation/tools/worktree-reclaim.js +73 -2
- package/core/.formation/tools/worktree-reclaim.test.js +113 -0
- package/core/.kenaz/specialist/ansuz_rules.yaml +7 -51
- package/core/.kenaz/specialist/ansuz_session_handoff.schema.json +2 -6
- package/core/.rule/general/project-self-containment.yaml +2 -2
- package/core/.specialist/Amelia/README.md +1 -1
- package/core/.specialist/Amelia/rule.yaml +1 -1
- package/core/.specialist/Ansuz/RULES.md +6 -2
- package/core/.specialist/Ansuz/concepts/commitment_layer.yaml +1 -1
- package/core/.specialist/Ansuz/concepts/evolvable_guardrails.yaml +1 -1
- package/core/.specialist/Ansuz/knowledge.yaml +1 -3
- package/core/.specialist/tools/__tests__/task-2409-lessons.test.js +10 -0
- package/core/.specialist/tools/__tests__/task-2427-harvest.test.js +25 -0
- package/core/.specialist/tools/ansuz-boot-fast.js +1 -1
- package/core/.specialist/tools/failure-detector.js +4 -4
- package/core/.specialist/tools/handoff-doc.js +1 -1
- package/core/.specialist/tools/lessons.js +2 -2
- package/core/CLAUDE.md +5 -5
- package/core/KENAZ_CORE_VERSION +1 -1
- package/core/dashboard/scripts/install-kenaz-cli.js +56 -30
- package/core/dev/scripts/check-file-size.js +1 -1
- package/core/dev/scripts/ci-feedback.js +1 -1
- package/core/dev/scripts/gc-agent-worktrees.js +13 -12
- package/core/dev/scripts/kenaz-session.js +3 -3
- package/core/dev/scripts/peer-identity-e2e.js +6 -4
- package/core/dev/scripts/run-rust-tests.js +2 -2
- package/core/dev/scripts/skill-routing-replay.js +3 -3
- package/core/dev/scripts/task1961/selftest.js +2 -2
- package/core/dev/scripts/windows-hide-guard.test.js +112 -0
- package/core/plugins/kenaz/guidance.md +1 -0
- package/core/plugins/kenaz/hooks/core-resolve.js +1 -1
- package/core/plugins/kenaz/hooks/hooks.json +9 -0
- package/core/plugins/kenaz/hooks/kenaz-hook.js +58 -4
- package/core/plugins/kenaz/hooks/worktree-guard.js +121 -0
- package/core/plugins/kenaz/hooks/worktree-guard.test.js +75 -0
- package/core/plugins/kenaz/scripts/kenaz.test.js +72 -5
- package/core/plugins/kenaz-peer/hooks/register.test.ts +14 -2
- package/core/plugins/kenaz-peer/hooks/register.ts +6 -1
- package/lib/cli.js +9 -5
- package/package.json +6 -6
- package/vendor/install-kenaz-cli.js +56 -30
- package/core/.kenaz/designs/METAPLASTICITY_CONFIDENCE_DESIGN.md +0 -537
- package/core/.kenaz/designs/REFLEX_INITIATOR_DESIGN.md +0 -501
- package/core/.kenaz/designs/TASK_1385_handoff_mcp_design.md +0 -426
- package/core/.kenaz/designs/TASK_932_hippocampus_consolidation.md +0 -103
- package/core/.kenaz/designs/TASK_934_efe_signal_engine.md +0 -97
- package/core/.kenaz/designs/TASK_935_self_evolution_framework.md +0 -154
- package/core/.kenaz/designs/VISION_cognitive_architecture_roadmap.md +0 -159
- package/core/.kenaz/designs/metaplasticity_simulation_results.json +0 -696
- package/core/.kenaz/main-memory/README.md +0 -230
- package/core/.kenaz/main-memory/kenaz/cortex/001_cortex_overview.md +0 -168
- package/core/.kenaz/main-memory/kenaz/cortex/001_rag_engine_overview.md +0 -30
- package/core/.kenaz/main-memory/kenaz/memory-system/001_three_tier_architecture.md +0 -361
- package/core/.kenaz/main-memory/kenaz/pipeline/001_task_execution_flow.md +0 -117
- package/core/.kenaz/main-memory/kenaz/pipeline/001_task_granularity.md +0 -154
- package/core/.kenaz/main-memory/kenaz/pipeline/002_team_priority.md +0 -51
- package/core/.kenaz/main-memory/kenaz/pipeline/003_feature_id_system.md +0 -46
- package/core/.kenaz/main-memory/kenaz/rules/001_gen_007_self_containment.md +0 -108
- package/core/.kenaz/main-memory/kenaz/rules/001_rule_priority_system.md +0 -121
- package/core/.kenaz/main-memory/kenaz/rules/002_agt_006_pre_check.md +0 -0
- package/core/.kenaz/main-memory/kenaz/rules/003_ppl_002_task_archival.md +0 -48
- package/core/.kenaz/main-memory/kenaz/system/001_dual_track_task_system.md +0 -197
- package/core/.kenaz/main-memory/knowledge/patterns/001_json_bom_issue.md +0 -78
- package/core/.kenaz/main-memory/knowledge/patterns/001_leader_worker_pattern.md +0 -0
- package/core/.kenaz/main-memory/knowledge/patterns/002_scope_path_conflict.md +0 -115
- package/core/.kenaz/main-memory/knowledge/patterns/002_task_dependency_resolution.md +0 -223
- package/core/.kenaz/main-memory/knowledge/patterns/003_question_protocol.md +0 -242
- package/core/.kenaz/main-memory/knowledge/patterns/004_user_insight_value.md +0 -111
- package/core/.kenaz/main-memory/knowledge/patterns/005_file_lock_pattern.md +0 -274
- package/core/.kenaz/main-memory/knowledge/references/001_ppl_rules.md +0 -28
- package/core/.kenaz/main-memory/knowledge/solutions/001_json_bom_issue.md +0 -137
- package/core/.kenaz/main-memory/knowledge/solutions/001_team_invocation.md +0 -0
- package/core/.kenaz/main-memory/knowledge/solutions/002_passive_monitoring.md +0 -0
- package/core/.kenaz/main-memory/knowledge/solutions/003_windows_file_race_condition.md +0 -239
- package/core/.kenaz/main-memory/registry.json +0 -326
- package/core/.kenaz/main-memory/version.yaml +0 -58
- package/core/.kenaz/specialist/memory_guard_fired.json +0 -1
- package/core/.kenaz/specialist/memory_guard_trigger_cache.json +0 -1
- package/core/.kenaz/specialist/memory_source_priority.yaml +0 -260
- package/core/.kenaz/specialist/prompt_1775.txt +0 -317
- package/core/.kenaz/specialist/prompt_1776.txt +0 -326
- package/core/.kenaz/specialist/prompt_1791.txt +0 -320
- package/core/.kenaz/specialist/prompt_1792.txt +0 -320
- package/core/.kenaz/specialist/prompt_1795.txt +0 -281
- package/core/.kenaz/specialist/prompt_1813.txt +0 -332
- package/core/.kenaz/specialist/prompt_1814.txt +0 -401
- package/core/.kenaz/specialist/prompt_1815.txt +0 -394
- package/core/.kenaz/specialist/prompt_1816.txt +0 -437
- package/core/.kenaz/specialist/prompt_1818.txt +0 -361
- package/core/.kenaz/specialist/prompt_1819.txt +0 -421
- package/core/.kenaz/specialist/prompt_1821.txt +0 -345
- package/core/.kenaz/specialist/prompt_1822.txt +0 -313
- package/core/.kenaz/specialist/prompt_1824.txt +0 -348
- package/core/.kenaz/specialist/prompt_1826.txt +0 -388
- package/core/.kenaz/specialist/rune_efe_salience_gap.md +0 -21
- package/core/.kenaz/specialist/task1825_update.json +0 -43
- package/core/.kenaz/specialist/taskgen/consolidation_i.json +0 -38
- package/core/.kenaz/specialist/taskgen/csharp_a.json +0 -44
- package/core/.kenaz/specialist/taskgen/csharp_b.json +0 -40
- package/core/.kenaz/specialist/taskgen/embedding_e.json +0 -34
- package/core/.kenaz/specialist/taskgen/hygiene_fg.json +0 -39
- package/core/.kenaz/specialist/taskgen/pathology_h.json +0 -36
- package/core/.kenaz/specialist/taskgen/unity_noise_d.json +0 -38
- package/core/.kenaz/specialist/taskgen/visibility_c.json +0 -38
- package/core/.specialist/Ansuz/decisions/ADR-requirement-graph-layer.md +0 -390
- package/core/.specialist/Ansuz/self_model_seed.backup.json +0 -100
- package/core/.specialist/ansuz_session_handoff.json +0 -96
- package/core/dev/ALAYA_FIELD_FEEDBACK_DESIGN.md +0 -126
- package/core/dev/ANSUZ_SCAFFOLD_DIET_2026-09-20.md +0 -231
- package/core/dev/ANSUZ_STARTUP_INJECTION_REVIEW.md +0 -355
- package/core/dev/ANSUZ_WORKFLOW_MODERNIZATION.md +0 -143
- package/core/dev/CORTEX_META_GRAPH_ASSESSMENT.md +0 -99
- package/core/dev/FREYA_DOWNSTREAM_BUGS_2026-09-19.md +0 -44
- package/core/dev/GLOBAL_MEMORY_IDENTITY_CONSOLIDATION.md +0 -263
- package/core/dev/GUARD_EFFECTIVENESS_DESIGN.md +0 -180
- package/core/dev/HEALTH_GATE_VARIANCE_ASSESSMENT.md +0 -271
- package/core/dev/HOOK_DIET_2026-09-21.md +0 -126
- package/core/dev/JEV_INTEGRATION_PLAN.md +0 -189
- package/core/dev/KENAZ_AGENT_CONNECT_v1_SPEC.md +0 -139
- package/core/dev/MOBILE_DESIGN_SPEC.md +0 -569
- package/core/dev/MULTI_ANSUZ_SPEC.md +0 -136
- package/core/dev/MUNINN_RETIREMENT.md +0 -115
- package/core/dev/PHASE3_ATTRIBUTION_POPULATION_DIAGNOSIS.md +0 -211
- package/core/dev/PHASE3_P3-2B_TASKLEVEL_PROBE.md +0 -83
- package/core/dev/PHASE3_P3-2_POPULATION_DISJOINTNESS.md +0 -83
- package/core/dev/PHASE3_P3-2_REMEASURE_REPORT.md +0 -231
- package/core/dev/PREDICTION_GROUNDING_DESIGN.md +0 -376
- package/core/dev/PRODUCT_SPEC.md +0 -317
- package/core/dev/PROJECT_REGISTRY_DUPLICATE_ASSESSMENT.md +0 -86
- package/core/dev/STARTUP_TIMELINE_TASK_1995.md +0 -181
- package/core/dev/SYNAPSE_WORKER_PER_PROJECT.md +0 -881
- package/core/dev/TASK_1680_P3-3_DISPATCH_SPEC.md +0 -96
- package/core/dev/TASK_1684_CALIBRATION_IMPACT_ANALYSIS.md +0 -170
- package/core/dev/TASK_1684_FORK_A_GOODHART_DESIGN.md +0 -171
- package/core/dev/TASK_1684_P3_2_REMEASURE_VALIDATION.md +0 -262
- package/core/dev/TASK_1903_SIGNAL_AUC_MEASUREMENT.md +0 -207
- package/core/dev/TASK_1904_BRANCH_INTEGRITY_AUDIT.md +0 -146
- package/core/dev/ansuz-eval/README.md +0 -38
- package/core/dev/ansuz-eval/build-fixtures.js +0 -87
- package/core/dev/ansuz-eval/grade.js +0 -96
- package/core/dev/ansuz-eval/grader.test.js +0 -117
- package/core/dev/ansuz-eval/tasks.md +0 -32
- package/core/dev/archive/ansuz/BOOT_FULL.md +0 -141
- package/core/dev/archive/ansuz/agents/ansuz-boot.md +0 -176
- package/core/dev/archive/ansuz/designs/alaya-passive-surfacing.md +0 -84
- package/core/dev/archive/ansuz/designs/cc_memory_indexing.md +0 -307
- package/core/dev/archive/ansuz/designs/check_guard.md +0 -322
- package/core/dev/archive/ansuz/designs/consequence_loop.md +0 -227
- package/core/dev/archive/ansuz/designs/mcp_kuzudb_lock_architecture.md +0 -312
- package/core/dev/archive/ansuz/designs/phase0_git_enrichment.md +0 -278
- package/core/dev/archive/ansuz/designs/refactor_mcp_tools_synapse.md +0 -490
- package/core/dev/archive/ansuz/designs/semantic_markdown_extraction.md +0 -167
- package/core/dev/archive/ansuz/designs/task_1372_prompt_injects_into.md +0 -193
- package/core/dev/archive/ansuz/designs/thought_stack.md +0 -286
- package/core/dev/archive/ansuz/investigations/reachability_unified_api_2026-04-11.md +0 -330
- package/core/dev/archive/ansuz/investigations/synapse_orphans_indexing_bug_2026-04-11.md +0 -352
- package/core/dev/archive/ansuz/investigations/synapse_orphans_reindex_verification_2026-04-11.md +0 -48
- package/core/dev/archive/ansuz/investigations/synapse_orphans_verification_2026-04-11.md +0 -170
- package/core/dev/archive/ansuz/legacy/kernel.yaml +0 -399
- package/core/dev/archive/ansuz/legacy/phases/phase_0.yaml +0 -418
- package/core/dev/archive/ansuz/legacy/phases/phase_1.yaml +0 -376
- package/core/dev/archive/ansuz/legacy/phases/phase_10.yaml +0 -35
- package/core/dev/archive/ansuz/legacy/phases/phase_11.yaml +0 -582
- package/core/dev/archive/ansuz/legacy/phases/phase_2.yaml +0 -94
- package/core/dev/archive/ansuz/legacy/phases/phase_3.yaml +0 -274
- package/core/dev/archive/ansuz/legacy/phases/phase_4.yaml +0 -67
- package/core/dev/archive/ansuz/legacy/phases/phase_5.yaml +0 -32
- package/core/dev/archive/ansuz/legacy/phases/phase_6.yaml +0 -91
- package/core/dev/archive/ansuz/legacy/phases/phase_7.yaml +0 -58
- package/core/dev/archive/ansuz/legacy/phases/phase_8.yaml +0 -146
- package/core/dev/archive/ansuz/legacy/phases/phase_9.yaml +0 -424
- package/core/dev/archive/ansuz/specs/INDEX_bifrost_hook_parity.yaml +0 -92
- package/core/dev/archive/ansuz/specs/active-inference-formation.yaml +0 -453
- package/core/dev/archive/ansuz/specs/brief_TASK_1228_userpromptsubmit.yaml +0 -191
- package/core/dev/archive/ansuz/specs/brief_TASK_1229_pretooluse_posttooluse.yaml +0 -250
- package/core/dev/archive/ansuz/specs/brief_TASK_1230_sessionstart_stop.yaml +0 -301
- package/core/dev/archive/ansuz/specs/brief_TASK_1231_verification.yaml +0 -272
- package/core/dev/archive/skills/feature_agent/SKILL.md +0 -289
- package/core/dev/design/PHASE4_DESIGN.md +0 -559
- package/core/dev/design/dashboard_docs_integration_PLAN.md +0 -388
- package/core/dev/design/matrix_format_ABBREVIATIONS.md +0 -655
- package/core/dev/design/matrix_format_DESIGN_SPEC.md +0 -601
- package/core/dev/design/matrix_format_DISCUSSION_SUMMARY.md +0 -484
- package/core/dev/design/matrix_format_EXAMPLE_memory.matrix +0 -13
- package/core/dev/design/matrix_format_EXAMPLE_project_status.matrix +0 -9
- package/core/dev/design/matrix_format_EXAMPLE_tasks.matrix +0 -14
- package/core/dev/design/matrix_format_SYNTAX_BNF.md +0 -754
- package/core/dev/design/matrix_format_TOKEN_COMPARISON.md +0 -484
- package/core/dev/design/matrix_v2_COGNITIVE_DESIGN.md +0 -503
- package/core/dev/design/matrix_v2_DISCUSSION_SUMMARY.md +0 -414
- package/core/dev/design/matrix_v2_EXAMPLE.matrix +0 -67
- package/core/dev/designs/EXPANDABLE_CARD_DESIGN_SPEC.md +0 -509
- package/core/dev/jev-eval/ACTIVE_CORRECTION.md +0 -52
- package/core/dev/jev-eval/ANNOTATION_GUIDE.md +0 -68
- package/core/dev/jev-eval/BASELINE_COMPARISON.md +0 -45
- package/core/dev/jev-eval/CONTEXT_REVIEW.md +0 -31
- package/core/dev/jev-eval/EVALUATION_STATUS.md +0 -39
- package/core/dev/jev-eval/HISTORICAL_CORPUS.md +0 -33
- package/core/dev/jev-eval/PACKAGING_VERIFICATION.md +0 -42
- package/core/dev/jev-eval/README.md +0 -101
- package/core/dev/jev-eval/THALAMUS_RANKING.md +0 -58
- package/core/dev/jev-eval/VALIDATION_PROGRESS.md +0 -54
- package/core/dev/jev-eval/cli.mjs +0 -50
- package/core/dev/jev-eval/context.mjs +0 -183
- package/core/dev/jev-eval/corpus.mjs +0 -186
- package/core/dev/jev-eval/fixtures/conversation-review.seed.jsonl +0 -6
- package/core/dev/jev-eval/fixtures/synthetic.jsonl +0 -11
- package/core/dev/jev-eval/metrics.mjs +0 -67
- package/core/dev/jev-eval/muninn-baseline.mjs +0 -119
- package/core/dev/jev-eval/providers.mjs +0 -95
- package/core/dev/jev-eval/reports/annotation-pilot-2026-09-20.json +0 -32
- package/core/dev/jev-eval/reports/context-review-2026-09-20.json +0 -48
- package/core/dev/jev-eval/reports/conversation-review.pending.json +0 -151
- package/core/dev/jev-eval/reports/history-corpus-2026-09-20.json +0 -52
- package/core/dev/jev-eval/reports/length-probe-2026-09-20.json +0 -133
- package/core/dev/jev-eval/reports/live-smoke-2026-09-20.json +0 -616
- package/core/dev/jev-eval/reports/muninn-baseline-2026-09-20.json +0 -52
- package/core/dev/jev-eval/reports/resilience-2026-09-20.json +0 -520
- package/core/dev/jev-eval/reports/rules-baseline.json +0 -197
- package/core/dev/jev-eval/reports/synthetic-review.pending.json +0 -357
- package/core/dev/jev-eval/resilience.mjs +0 -71
- package/core/dev/jev-eval/review.mjs +0 -78
- package/core/dev/jev-eval/schema.mjs +0 -87
- package/core/dev/jev-eval/test/context.test.mjs +0 -95
- package/core/dev/jev-eval/test/corpus.test.mjs +0 -102
- package/core/dev/jev-eval/test/eval.test.mjs +0 -146
- package/core/dev/jev-eval/test/muninn-baseline.test.mjs +0 -71
- package/core/dev/jev-eval/test/resilience.test.mjs +0 -72
- package/core/dev/jev-eval/test/review.test.mjs +0 -61
- package/core/dev/pipeline/PHASE3_PLANNING_SUMMARY.md +0 -338
- package/core/dev/pipeline/PROGRESS.md +0 -113
- package/core/dev/pipeline/PROGRESS_template.md +0 -860
- package/core/dev/pipeline/QA_REPORT_F008.md +0 -431
- package/core/dev/pipeline/QA_REPORT_LOCAL_CLAUDE_DIAGNOSIS.md +0 -583
- package/core/dev/pipeline/README.md +0 -210
- package/core/dev/pipeline/WORKFLOW_GUIDE.md +0 -824
- package/core/dev/pipeline/archived/TASK_015_tauri_init.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_016_tauri_commands.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_017_rust_pty.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_018_tauri_bundle.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_019_release_workflow.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_020_update_ui.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_021_update_notification_ui.yaml +0 -55
- package/core/dev/pipeline/archived/TASK_022_remove_node_pty.yaml +0 -65
- package/core/dev/pipeline/archived/TASK_023_api_routes_migration.yaml +0 -86
- package/core/dev/pipeline/archived/TASK_024_feature_id_system.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_025_executable_acceptance.yaml +0 -66
- package/core/dev/pipeline/archived/TASK_026_spec_versioning.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_027_drift_detection.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_028_tauri_pty_manager.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_029_tauri_pty_commands.yaml +0 -62
- package/core/dev/pipeline/archived/TASK_030_frontend_session_adapter.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_031_terminal_tauri_events.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_041_scheduler_data_models.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_042_path_lock_manager.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_043_process_manager.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_044_git_integration.yaml +0 -85
- package/core/dev/pipeline/archived/TASK_045_task_queue_manager.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_046_scheduler_dispatcher.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_047_tauri_scheduler_commands.yaml +0 -55
- package/core/dev/pipeline/archived/TASK_048_realtime_status_push.yaml +0 -92
- package/core/dev/pipeline/archived/TASK_049_frontend_scheduler_integration.yaml +0 -58
- package/core/dev/pipeline/archived/TASK_050_error_recovery.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_051_optimization_proposals_backend.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_052_optimization_proposals_ui.yaml +0 -58
- package/core/dev/pipeline/archived/TASK_053_optimization_proposals_diff_view.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_054_multi_project_scheduler_state.yaml +0 -76
- package/core/dev/pipeline/archived/TASK_055_scheduler_api_project_scope.yaml +0 -64
- package/core/dev/pipeline/archived/TASK_056_frontend_scheduler_project_scope.yaml +0 -62
- package/core/dev/pipeline/archived/TASK_057_scheduler_module_structure.yaml +0 -54
- package/core/dev/pipeline/archived/TASK_058_scheduler_models_extract.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_059_scheduler_core_extract.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_060_scheduler_commands_extract.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_061_scheduler_specialized_commands.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_062_process_manager_module_structure.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_063_process_manager_core_extract.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_064_recovery_module_structure.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_065_recovery_core_extract.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_066_self_enhancement_scheduler_models.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_067_agents_section_quick_actions.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_067_self_enhancement_scheduler_core.yaml +0 -65
- package/core/dev/pipeline/archived/TASK_068_agent_workflow_rule_enhancement.yaml +0 -46
- package/core/dev/pipeline/archived/TASK_068_self_enhancement_tauri_commands.yaml +0 -61
- package/core/dev/pipeline/archived/TASK_069_agent_wizard_responsive.yaml +0 -46
- package/core/dev/pipeline/archived/TASK_069_self_enhancement_ui.yaml +0 -62
- package/core/dev/pipeline/archived/TASK_070_preview_panel_redesign.yaml +0 -62
- package/core/dev/pipeline/archived/TASK_070_self_enhancement_integration.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_071_preview_panel_qa.yaml +0 -98
- package/core/dev/pipeline/archived/TASK_071_single_agent_config.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_072_preview_modal_esc_fix.yaml +0 -71
- package/core/dev/pipeline/archived/TASK_072_product_review_module.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_073_agents_page_component_refactor.yaml +0 -68
- package/core/dev/pipeline/archived/TASK_073_rename_single_agent.yaml +0 -64
- package/core/dev/pipeline/archived/TASK_074_preview_mode_ui_diagnosis.yaml +0 -71
- package/core/dev/pipeline/archived/TASK_074_single_agent_ui_toggle.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_075_agents_page_component_refactor.yaml +0 -69
- package/core/dev/pipeline/archived/TASK_075_single_agent_integration_test.yaml +0 -75
- package/core/dev/pipeline/archived/TASK_076_preview_mode_ui_diagnosis.yaml +0 -70
- package/core/dev/pipeline/archived/TASK_076_single_agent_continuous_mode.yaml +0 -65
- package/core/dev/pipeline/archived/TASK_077_failure_directory_structure.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_077_single_agent_typescript_types.yaml +0 -59
- package/core/dev/pipeline/archived/TASK_078_fail_001_agent_no_output.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_078_single_agent_ui_simplify.yaml +0 -74
- package/core/dev/pipeline/archived/TASK_079_dashboard_rwd_responsive.yaml +0 -63
- package/core/dev/pipeline/archived/TASK_079_fail_002_json_bom.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_080_fail_003_queue_pollution.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_080_http_server_module.yaml +0 -55
- package/core/dev/pipeline/archived/TASK_081_failure_logging_tools.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_081_http_api_routes.yaml +0 -62
- package/core/dev/pipeline/archived/TASK_082_frontend_api_adapter.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_082_integrate_failure_to_workflow.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_083_cleanup_nextjs_api.yaml +0 -48
- package/core/dev/pipeline/archived/TASK_083_task_queue_cleanup.yaml +0 -67
- package/core/dev/pipeline/archived/TASK_084_rust_dead_code_cleanup.yaml +0 -66
- package/core/dev/pipeline/archived/TASK_084_scheduler_sync_logic_fix.yaml +0 -68
- package/core/dev/pipeline/archived/TASK_085_http_api_web_mode_fixes.yaml +0 -46
- package/core/dev/pipeline/archived/TASK_085_memory_consolidation_0204_0205.yaml +0 -98
- package/core/dev/pipeline/archived/TASK_086_collapsible_preview_panel.yaml +0 -161
- package/core/dev/pipeline/archived/TASK_086_web_mode_feature_parity.yaml +0 -62
- package/core/dev/pipeline/archived/TASK_087_manual_memory_archival.yaml +0 -163
- package/core/dev/pipeline/archived/TASK_087_mobile_http_control.yaml +0 -68
- package/core/dev/pipeline/archived/TASK_088_fail_003_to_ppl_002_rule.yaml +0 -63
- package/core/dev/pipeline/archived/TASK_088_mobile_http_qa.yaml +0 -121
- package/core/dev/pipeline/archived/TASK_089_agent_collaboration_topic.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_089_web_mode_monitor_fix.yaml +0 -58
- package/core/dev/pipeline/archived/TASK_090_cli_detection_fix.yaml +0 -61
- package/core/dev/pipeline/archived/TASK_090_ui_ux_lessons_topic.yaml +0 -63
- package/core/dev/pipeline/archived/TASK_091_expandable_card_design.yaml +0 -56
- package/core/dev/pipeline/archived/TASK_091_move_agent_section_components.yaml +0 -65
- package/core/dev/pipeline/archived/TASK_092_expandable_card_component.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_092_refactor_agent_create_wizard.yaml +0 -84
- package/core/dev/pipeline/archived/TASK_093_taskcard_detail_integration.yaml +0 -57
- package/core/dev/pipeline/archived/TASK_093_update_barrel_exports_test.yaml +0 -84
- package/core/dev/pipeline/archived/TASK_094_ai_agent_generation_enhancement.yaml +0 -115
- package/core/dev/pipeline/archived/TASK_094_proposalcard_detail_integration.yaml +0 -55
- package/core/dev/pipeline/archived/TASK_095_preview_fixes.yaml +0 -129
- package/core/dev/pipeline/archived/TASK_095_single_agent_task_selector.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_096_agents_page_ux_improvements.yaml +0 -163
- package/core/dev/pipeline/archived/TASK_096_single_agent_status_sync.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_097_local_claude_error_logging.yaml +0 -59
- package/core/dev/pipeline/archived/TASK_097_single_agent_monitor_events.yaml +0 -59
- package/core/dev/pipeline/archived/TASK_098_product_manager_team_phase2.yaml +0 -60
- package/core/dev/pipeline/archived/TASK_098_single_agent_refactor_test.yaml +0 -58
- package/core/dev/pipeline/archived/TASK_099_backend_team_creation.yaml +0 -258
- package/core/dev/pipeline/archived/TASK_100_frontend_team_creation.yaml +0 -61
- package/core/dev/pipeline/archived/TASK_101_orchestrator_system.yaml +0 -403
- package/core/dev/pipeline/archived/TASK_102_designer_sre_teams.yaml +0 -90
- package/core/dev/pipeline/archived/TASK_103_integration_testing.yaml +0 -86
- package/core/dev/pipeline/archived/TASK_128_integration_testing.yaml +0 -83
- package/core/dev/pipeline/archived/TASK_134_cortex_v2_phase3_file_watcher.yaml +0 -65
- package/core/dev/pipeline/archived/TASK_134_team_http_api.yaml +0 -96
- package/core/dev/pipeline/archived/TASK_135_cortex_v2_phase3_git_monitor.yaml +0 -63
- package/core/dev/pipeline/archived/TASK_136_cortex_v2_phase3_change_analyzer.yaml +0 -69
- package/core/dev/pipeline/archived/TASK_137_cortex_v2_phase3_cache_invalidator.yaml +0 -67
- package/core/dev/pipeline/archived/TASK_137_team_orchestrator_integration.yaml +0 -93
- package/core/dev/pipeline/archived/TASK_138_cortex_v2_phase3_distributed_cache.yaml +0 -68
- package/core/dev/pipeline/archived/TASK_138_matrix_folder_structure.yaml +0 -61
- package/core/dev/pipeline/archived/TASK_139_cortex_v2_phase3_cache_prewarming.yaml +0 -65
- package/core/dev/pipeline/archived/TASK_146_unified_documentation.yaml +0 -141
- package/core/dev/pipeline/archived/TASK_147_pipeline_execution_rules.yaml +0 -76
- package/core/dev/pipeline/archived/TASK_148_update_claude_md.yaml +0 -77
- package/core/dev/pipeline/archived/TASK_149_fix_nextjs_mdx_serialization.yaml +0 -63
- package/core/dev/pipeline/archived/TASK_149_update_team_docs.yaml +0 -77
- package/core/dev/pipeline/archived/TASK_150_pipeline_workflow_guide.yaml +0 -82
- package/core/dev/pipeline/archived/TASK_164_fix_smart_context_switch.yaml +0 -49
- package/core/dev/pipeline/archived/TASK_165_ctags_symbol_index.yaml +0 -53
- package/core/dev/pipeline/archived/TASK_166_symbol_search_mcp_tool.yaml +0 -48
- package/core/dev/pipeline/archived/TASK_167_llm_module_summary.yaml +0 -55
- package/core/dev/pipeline/archived/TASK_168_map_reduce_context.yaml +0 -51
- package/core/dev/pipeline/archived/TASK_169_v2_integration_testing.yaml +0 -52
- package/core/dev/pipeline/backups/archive_2026-02-04T22-07-22/TASK_QUEUE_backup.json +0 -95
- package/core/dev/pipeline/docs/multi-agent-coordination.md +0 -446
- package/core/dev/pipeline/docs/overview.md +0 -406
- package/core/dev/pipeline/docs/task-management.md +0 -412
- package/core/dev/pipeline/docs/workflows.md +0 -32
- package/core/dev/pipeline/orchestrator/schemas/task_queue_schema.json +0 -58
- package/core/dev/pipeline/orchestrator/schemas/task_schema.json +0 -139
- package/core/dev/pipeline/plans/PLAN_task_cli_refactor.md +0 -281
- package/core/dev/pipeline/test_results/TASK_TEST_PARALLEL_002_result.txt +0 -27
- package/core/dev/plans/ANSUZ_SLIM_PLAN.md +0 -68
- package/core/dev/plans/CLI_FIRST_INSTALL_FLOW.md +0 -120
- package/core/dev/plans/FORMATION_RETIREMENT_PLAN.md +0 -313
- package/core/dev/plans/KUZU_REPLACEMENT_PLAN.md +0 -126
- package/core/dev/scripts/CRASH_DIAGNOSIS.md +0 -47
- package/core/dev/scripts/README.md +0 -142
- package/core/dev/scripts/RUN_ONCE.bat +0 -40
- package/core/dev/scripts/START_DEV_AGENT.bat +0 -63
- package/core/dev/scripts/START_MULTI_AGENT.bat +0 -80
- package/core/dev/scripts/dev_agent_scheduler.ps1 +0 -536
- package/core/dev/scripts/init_git.ps1 +0 -396
- package/core/dev/scripts/init_git.sh +0 -337
- package/core/dev/scripts/init_project.ps1 +0 -851
- package/core/dev/scripts/init_project.sh +0 -477
- package/core/dev/scripts/multi_agent_scheduler.ps1 +0 -2021
- package/core/dev/scripts/multi_agent_scheduler.sh +0 -1344
- package/core/dev/scripts/run_once.sh +0 -47
- package/core/dev/scripts/setup_rag.ps1 +0 -304
- package/core/dev/scripts/setup_rag.sh +0 -230
- package/core/dev/scripts/start_dev_agent.sh +0 -137
- package/core/dev/scripts/start_multi_agent.sh +0 -41
- package/core/dev/scripts/sync_task_queue.ps1 +0 -505
- package/core/dev/scripts/sync_task_queue.sh +0 -392
- package/core/dev/specs/agent-connect/PROTOCOL.md +0 -177
- package/core/dev/specs/agent-connect/SDK_GUIDE.md +0 -915
- package/core/dev/specs/agent-connect/examples/minimal-site/README.md +0 -137
- package/core/dev/specs/agent-connect/examples/minimal-site/package.json +0 -12
- package/core/dev/specs/agent-connect/examples/minimal-site/public/index.html +0 -116
- package/core/dev/specs/agent-connect/examples/minimal-site/public/install-redirect.js +0 -73
- package/core/dev/specs/agent-connect/examples/minimal-site/server.js +0 -516
- package/core/dev/specs/agent-connect/examples/minimal-site/test/smoke.test.mjs +0 -263
- package/core/dev/specs/agent-connect/history/DEFECT_REPORT_kenaz-agent-hub_2026-09-09_v0.4-empty-prompt-no-first-turn.md +0 -77
- package/core/dev/specs/agent-connect/history/DEFECT_REPORT_kenaz-agent-hub_2026-09-09_v0.4-prompt-mojibake.md +0 -90
- package/core/dev/specs/agent-connect/history/FEATURE_REQUEST_kenaz-agent-hub_2026-09-07.md +0 -61
- package/core/dev/specs/agent-connect/history/FEATURE_REQUEST_kenaz-agent-hub_2026-09-08_relay-v1-conformance.md +0 -76
- package/core/dev/specs/agent-connect/history/FEATURE_REQUEST_kenaz-agent-hub_2026-09-09_v0.4-session-channel.md +0 -87
- package/core/dev/specs/agent-connect/history/FLOWPIX_REPLY_agent-hub_2026-09-08_relay-v1-answers.md +0 -68
- package/core/dev/specs/agent-connect/history/FLOWPIX_bridge_CONTRACT.md +0 -642
- package/core/dev/specs/agent-connect/history/FLOWPIX_spikes_relay_spike_relay.mjs +0 -244
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-07.md +0 -77
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-08_direction-change-v0.3.md +0 -44
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-08_relay-v1-answers-ack.md +0 -37
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-08_relay-v1-conformance.md +0 -56
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-09_annotations-install-coldstart.md +0 -44
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-09_empty-prompt-first-turn.md +0 -56
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-09_prompt-mojibake-fixed.md +0 -48
- package/core/dev/specs/agent-connect/history/KENAZ_RESPONSE_agent-hub_2026-09-09_session-channel.md +0 -57
- package/core/dev/specs/agent-connect/history/PROTOCOL_v0.3_snapshot.md +0 -379
- package/core/dev/specs/agent-connect/history/README.md +0 -47
- package/core/dev/specs/peer/CODEX_INTERACTIVE_PUSH.md +0 -65
- package/core/dev/specs/peer/CODEX_MANAGED_DAEMON.md +0 -54
- package/core/dev/specs/peer/CODEX_PEER_PULL_SPIKE.md +0 -54
- package/core/dev/specs/peer/MODS_SPIKE.md +0 -133
- package/core/dev/specs/peer/PER_PROJECT_ADDRESSING.md +0 -143
- package/core/dev/specs/peer/SWARM_PROTOCOLS.md +0 -256
- package/core/dev/specs/peer/codex-hook-shim-peer.test.js +0 -113
- package/core/dev/specs/peer/codex-push-launcher.test.js +0 -142
- package/core/dev/specs/peer/setup-codex-hooks.test.js +0 -60
- package/core/dev/specs/peer-ansuz/DELIVERY_SPIKE.md +0 -397
- package/core/dev/specs/peer-ansuz/DESIGN.md +0 -109
- package/core/dev/specs/peer-ansuz/spike/claude_poke.js +0 -129
- package/core/dev/specs/peer-ansuz/spike/claude_session_start_hook.js +0 -37
- package/core/dev/specs/peer-ansuz/spike/claude_settings_hook.json +0 -14
- package/core/dev/specs/peer-ansuz/spike/codex_appserver_client.js +0 -105
- package/core/dev/specs/peer-ansuz/spike/codex_appserver_query.js +0 -29
- package/core/dev/specs/peer-ansuz/spike/extract_timeline.js +0 -26
- package/core/dev/specs/synapse/SYMBOL_IDENTITY.md +0 -305
- package/core/dev/spikes/A4-cypher-varlen.md +0 -176
- package/core/dev/spikes/bloat-rounds.sh +0 -25
- package/core/dev/spikes/mods/clean-claude.js +0 -9
- package/core/dev/spikes/mods/drive-probe.js +0 -29
- package/core/dev/spikes/mods/e2e-peer.js +0 -71
- package/core/dev/spikes/mods/evidence/e2e-peer-control.json +0 -17
- package/core/dev/spikes/mods/evidence/e2e-peer-mod.json +0 -17
- package/core/dev/spikes/mods/evidence/probe-006a6e65-d807-4bc1-b648-fd7d1edfe0b4.jsonl +0 -4
- package/core/dev/spikes/mods/evidence/probe-cebdf1f7-f9c4-47a8-83cd-7c0786177404.jsonl +0 -12
- package/core/dev/spikes/mods/evidence/probe-eb21147d-10ce-4c32-93ed-37ca37d88d5a.jsonl +0 -11
- package/core/dev/spikes/mods/evidence/stream-cebdf1f7.jsonl +0 -18
- package/core/dev/spikes/mods/kenaz-mod-probe/.claude-plugin/plugin.json +0 -1
- package/core/dev/spikes/mods/kenaz-mod-probe/hooks/hooks.json +0 -1
- package/core/dev/spikes/mods/kenaz-mod-probe/hooks/register.ts +0 -65
- package/core/dev/spikes/mods/kenaz-mod-probe/tsconfig.json +0 -3
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
# Factorised Active Inference for Formation Selection
|
|
2
|
-
# Design Specification — CP-1aba (TASK_972)
|
|
3
|
-
#
|
|
4
|
-
# Reference: arXiv:2411.07362 (Factorised Active Inference, AAMAS 2025)
|
|
5
|
-
# Key insight: each agent maintains a factorized generative model with beliefs
|
|
6
|
-
# about OTHER agents' hidden states. Applied here to Formation dispatch:
|
|
7
|
-
# the system maintains Dirichlet beliefs about each formation's competence
|
|
8
|
-
# per task type, and selects formations by minimizing Expected Free Energy.
|
|
9
|
-
#
|
|
10
|
-
# Compatible with existing EFE engine (efe.rs) additive structure:
|
|
11
|
-
# EFE(s) = G_risk + G_ambiguity + G_novelty (symbol-level)
|
|
12
|
-
# EFE(f) = G_pragmatic + G_epistemic (formation-level, this spec)
|
|
13
|
-
|
|
14
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
15
|
-
# Section 1: Overview
|
|
16
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
17
|
-
|
|
18
|
-
overview:
|
|
19
|
-
title: "Factorised Active Inference for Formation Selection"
|
|
20
|
-
version: "0.1.0"
|
|
21
|
-
status: "draft"
|
|
22
|
-
author: "TASK_972"
|
|
23
|
-
reference: "arXiv:2411.07362"
|
|
24
|
-
|
|
25
|
-
summary: |
|
|
26
|
-
Currently, Formation dispatch uses a static heuristic to select formation
|
|
27
|
-
type (unit > solo > squad > legion) based on task complexity and explicit
|
|
28
|
-
user overrides. This spec introduces a Bayesian learning layer that
|
|
29
|
-
maintains per-formation, per-task-type beliefs about completion success,
|
|
30
|
-
and uses Expected Free Energy (EFE) to select the optimal formation.
|
|
31
|
-
|
|
32
|
-
The system is factorized: each formation type (unit, solo, squad, legion)
|
|
33
|
-
is modeled as an independent factor with its own Dirichlet-distributed
|
|
34
|
-
belief over success/failure for each task type. This mirrors the AAMAS 2025
|
|
35
|
-
paper's approach where each agent maintains beliefs about other agents'
|
|
36
|
-
hidden states, but applied at the formation level.
|
|
37
|
-
|
|
38
|
-
goals:
|
|
39
|
-
- Learn which formations work best for which task types from dispatch history
|
|
40
|
-
- Balance exploitation (use known-good formations) with exploration (try uncertain ones)
|
|
41
|
-
- Gracefully degrade to static heuristic when insufficient data exists
|
|
42
|
-
- Integrate additively with existing EFE engine without breaking current behavior
|
|
43
|
-
|
|
44
|
-
formations:
|
|
45
|
-
- unit # Single agent, simplest dispatch
|
|
46
|
-
- solo # Single agent with enhanced context
|
|
47
|
-
- squad # Multi-agent parallel with synthesis
|
|
48
|
-
- legion # Lead agent coordinating sub-agents
|
|
49
|
-
|
|
50
|
-
task_types:
|
|
51
|
-
- synapse # Code intelligence, graph operations
|
|
52
|
-
- ui # Frontend/UI work
|
|
53
|
-
- backend # Backend/API development
|
|
54
|
-
- spec # Specification and documentation
|
|
55
|
-
- fix # Bug fixes, incident response
|
|
56
|
-
|
|
57
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
58
|
-
# Section 2: Phase 1 — Beliefs Schema
|
|
59
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
60
|
-
|
|
61
|
-
phase_1_beliefs_schema:
|
|
62
|
-
description: |
|
|
63
|
-
Dirichlet-distributed beliefs encode the system's uncertainty about each
|
|
64
|
-
formation's success probability for each task type. The Dirichlet is the
|
|
65
|
-
conjugate prior of the Categorical distribution, making Bayesian updates
|
|
66
|
-
trivial: simply increment the alpha corresponding to the observed outcome.
|
|
67
|
-
|
|
68
|
-
storage:
|
|
69
|
-
file: ".formation/specialist_beliefs.json"
|
|
70
|
-
format: "JSON"
|
|
71
|
-
backup: ".formation/specialist_beliefs.backup.json"
|
|
72
|
-
# Backup written before each update for crash recovery
|
|
73
|
-
|
|
74
|
-
schema:
|
|
75
|
-
description: |
|
|
76
|
-
Top-level keys are formation types. Each formation maps task types to
|
|
77
|
-
a Dirichlet parameter vector [alpha_success, alpha_failure].
|
|
78
|
-
|
|
79
|
-
The expected success probability is:
|
|
80
|
-
P(success | formation, task_type) = alpha_success / (alpha_success + alpha_failure)
|
|
81
|
-
|
|
82
|
-
Uncertainty decreases as alpha_sum = alpha_success + alpha_failure grows.
|
|
83
|
-
|
|
84
|
-
example:
|
|
85
|
-
unit:
|
|
86
|
-
synapse: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
87
|
-
ui: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
88
|
-
backend: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
89
|
-
spec: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
90
|
-
fix: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
91
|
-
solo:
|
|
92
|
-
synapse: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
93
|
-
ui: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
94
|
-
backend: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
95
|
-
spec: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
96
|
-
fix: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
97
|
-
squad:
|
|
98
|
-
synapse: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
99
|
-
ui: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
100
|
-
backend: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
101
|
-
spec: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
102
|
-
fix: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
103
|
-
legion:
|
|
104
|
-
synapse: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
105
|
-
ui: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
106
|
-
backend: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
107
|
-
spec: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
108
|
-
fix: { alpha_success: 1.0, alpha_failure: 1.0 }
|
|
109
|
-
|
|
110
|
-
initial_priors:
|
|
111
|
-
description: |
|
|
112
|
-
All alpha parameters start at 1.0 (uniform Dirichlet). This represents
|
|
113
|
-
maximum ignorance: P(success) = 0.5 for all formation-task combinations.
|
|
114
|
-
The system has no initial bias toward any formation.
|
|
115
|
-
alpha_success: 1.0
|
|
116
|
-
alpha_failure: 1.0
|
|
117
|
-
rationale: |
|
|
118
|
-
alpha=1 gives a uniform Beta(1,1) prior for each formation-task pair.
|
|
119
|
-
This is the least informative proper prior — equivalent to having seen
|
|
120
|
-
zero successes and zero failures, with no bias.
|
|
121
|
-
|
|
122
|
-
metadata:
|
|
123
|
-
description: "Additional tracking fields in the beliefs file"
|
|
124
|
-
fields:
|
|
125
|
-
version: "Schema version string (semver)"
|
|
126
|
-
updated_at: "ISO-8601 timestamp of last update"
|
|
127
|
-
total_dispatches: "Total observed dispatches across all formations"
|
|
128
|
-
dispatch_counts:
|
|
129
|
-
description: "Per-formation dispatch count for cold-start threshold checks"
|
|
130
|
-
example:
|
|
131
|
-
unit: 0
|
|
132
|
-
solo: 0
|
|
133
|
-
squad: 0
|
|
134
|
-
legion: 0
|
|
135
|
-
|
|
136
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
137
|
-
# Section 3: Phase 2 — EFE Computation for Formation Selection
|
|
138
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
139
|
-
|
|
140
|
-
phase_2_efe_computation:
|
|
141
|
-
description: |
|
|
142
|
-
Expected Free Energy (EFE) for formation selection. Lower EFE = better.
|
|
143
|
-
The formation with minimum EFE is selected.
|
|
144
|
-
|
|
145
|
-
EFE(formation, task_type) = -G_pragmatic(f, t) - G_epistemic(f, t)
|
|
146
|
-
|
|
147
|
-
This is additive and structurally compatible with the existing symbol-level
|
|
148
|
-
EFE in efe.rs (G_risk + G_ambiguity + G_novelty), but operates at a
|
|
149
|
-
different level of abstraction (formation selection vs symbol prioritization).
|
|
150
|
-
|
|
151
|
-
components:
|
|
152
|
-
pragmatic_value:
|
|
153
|
-
symbol: "G_pragmatic(f, t)"
|
|
154
|
-
description: |
|
|
155
|
-
Expected completion probability — exploitation term.
|
|
156
|
-
Higher means the formation is more likely to succeed at this task type.
|
|
157
|
-
formula: |
|
|
158
|
-
G_pragmatic(f, t) = E[P(success | f, t)]
|
|
159
|
-
= alpha_success / (alpha_success + alpha_failure)
|
|
160
|
-
range: "[0, 1]"
|
|
161
|
-
interpretation: |
|
|
162
|
-
When alpha_success >> alpha_failure, pragmatic value is high (near 1).
|
|
163
|
-
This drives exploitation: prefer formations with proven track records.
|
|
164
|
-
|
|
165
|
-
epistemic_value:
|
|
166
|
-
symbol: "G_epistemic(f, t)"
|
|
167
|
-
description: |
|
|
168
|
-
Information gain from choosing this formation — exploration term.
|
|
169
|
-
Higher when we are uncertain about the formation's competence.
|
|
170
|
-
formula: |
|
|
171
|
-
G_epistemic(f, t) = H[Dir(alpha)] - E[H[Cat(theta)]]
|
|
172
|
-
|
|
173
|
-
Simplified (for Dirichlet with 2 categories, i.e., Beta distribution):
|
|
174
|
-
G_epistemic(f, t) = 1 / (alpha_success + alpha_failure + 1)
|
|
175
|
-
rationale: |
|
|
176
|
-
The exact mutual information between parameters and outcomes for a
|
|
177
|
-
Beta-Bernoulli model. As total observations grow (alpha_sum increases),
|
|
178
|
-
epistemic value decreases — we learn less from additional trials.
|
|
179
|
-
When alpha_sum is small (few observations), epistemic value is high,
|
|
180
|
-
driving exploration of uncertain formations.
|
|
181
|
-
range: "(0, 1)"
|
|
182
|
-
interpretation: |
|
|
183
|
-
New formations (alpha_sum ≈ 2) have epistemic ≈ 0.33.
|
|
184
|
-
Well-observed formations (alpha_sum ≈ 50) have epistemic ≈ 0.02.
|
|
185
|
-
This naturally implements an explore-exploit tradeoff.
|
|
186
|
-
|
|
187
|
-
selection_formula:
|
|
188
|
-
description: |
|
|
189
|
-
Combine pragmatic and epistemic values with a temperature-controlled
|
|
190
|
-
softmax to produce a formation selection policy.
|
|
191
|
-
|
|
192
|
-
efe_score: |
|
|
193
|
-
EFE(f, t) = w_pragmatic * G_pragmatic(f, t) + w_epistemic * G_epistemic(f, t)
|
|
194
|
-
|
|
195
|
-
policy: |
|
|
196
|
-
pi(f | t) = softmax(EFE(f, t) / temperature)
|
|
197
|
-
= exp(EFE(f, t) / T) / sum_f'(exp(EFE(f', t) / T))
|
|
198
|
-
|
|
199
|
-
selection: |
|
|
200
|
-
selected_formation = argmax_f pi(f | t)
|
|
201
|
-
|
|
202
|
-
Alternatively, sample from pi(f | t) to allow stochastic exploration.
|
|
203
|
-
Recommendation: use argmax in production, sample during cold-start phase.
|
|
204
|
-
|
|
205
|
-
weights:
|
|
206
|
-
w_pragmatic:
|
|
207
|
-
default: 1.0
|
|
208
|
-
description: "Weight for exploitation (pragmatic value)"
|
|
209
|
-
w_epistemic:
|
|
210
|
-
default: 0.5
|
|
211
|
-
description: |
|
|
212
|
-
Weight for exploration (epistemic value). Set < 1.0 to favor
|
|
213
|
-
exploitation over exploration. Tunable based on operational needs.
|
|
214
|
-
temperature:
|
|
215
|
-
default: 1.0
|
|
216
|
-
description: |
|
|
217
|
-
Softmax temperature. Higher = more uniform (exploratory).
|
|
218
|
-
Lower = more peaked (exploitative). Adaptive temperature from
|
|
219
|
-
efe.rs could be reused here if health signals are available.
|
|
220
|
-
|
|
221
|
-
compatibility_with_efe_rs:
|
|
222
|
-
description: |
|
|
223
|
-
The existing efe.rs operates at symbol-level (which symbols to prioritize).
|
|
224
|
-
This formation-level EFE operates at dispatch-level (which formation to use).
|
|
225
|
-
They are complementary and do not conflict:
|
|
226
|
-
|
|
227
|
-
1. Formation EFE selects the formation type for a dispatch
|
|
228
|
-
2. Symbol EFE (efe.rs) prioritizes symbols within that dispatch
|
|
229
|
-
|
|
230
|
-
Both use additive free energy decomposition. The formation EFE weights
|
|
231
|
-
(w_pragmatic, w_epistemic) could eventually be learned by the same
|
|
232
|
-
weight-learning mechanism in efe.rs (TASK_960), but this is out of scope.
|
|
233
|
-
|
|
234
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
235
|
-
# Section 4: Phase 3 — Posterior Update
|
|
236
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
237
|
-
|
|
238
|
-
phase_3_posterior_update:
|
|
239
|
-
description: |
|
|
240
|
-
After each dispatch completes, update the Dirichlet beliefs based on the
|
|
241
|
-
observed outcome. This is the Bayesian learning loop.
|
|
242
|
-
|
|
243
|
-
trigger: "post-complete hook (post-complete.js) after dispatch finishes"
|
|
244
|
-
|
|
245
|
-
outcome_classification:
|
|
246
|
-
description: |
|
|
247
|
-
Map dispatch results to binary success/failure for belief updates.
|
|
248
|
-
rules:
|
|
249
|
-
- condition: "task moved to done/ by task-api.js complete"
|
|
250
|
-
outcome: "success"
|
|
251
|
-
- condition: "task moved to blocked/ or agent exits with error"
|
|
252
|
-
outcome: "failure"
|
|
253
|
-
- condition: "task moved to blocked/ but later unblocked and completed"
|
|
254
|
-
outcome: "success (delayed — update on final completion only)"
|
|
255
|
-
- condition: "dispatch timeout or agent crash"
|
|
256
|
-
outcome: "failure"
|
|
257
|
-
|
|
258
|
-
update_rule:
|
|
259
|
-
description: |
|
|
260
|
-
Conjugate Bayesian update for Dirichlet-Bernoulli model.
|
|
261
|
-
This is exact — no approximation needed.
|
|
262
|
-
on_success: |
|
|
263
|
-
alpha_success[formation][task_type] += 1.0
|
|
264
|
-
on_failure: |
|
|
265
|
-
alpha_failure[formation][task_type] += 1.0
|
|
266
|
-
atomicity: |
|
|
267
|
-
Read beliefs file → update in memory → write backup → write beliefs file.
|
|
268
|
-
Use file locking or atomic rename to prevent corruption from concurrent
|
|
269
|
-
dispatches (squad/legion run multiple agents in parallel).
|
|
270
|
-
|
|
271
|
-
decay:
|
|
272
|
-
description: |
|
|
273
|
-
Optional: exponential decay to make beliefs more responsive to recent
|
|
274
|
-
outcomes. Without decay, early observations dominate forever.
|
|
275
|
-
enabled: false
|
|
276
|
-
mechanism: |
|
|
277
|
-
Before each update, decay all alphas toward the prior:
|
|
278
|
-
alpha = prior + decay_rate * (alpha - prior)
|
|
279
|
-
where prior = 1.0 and decay_rate ∈ (0, 1).
|
|
280
|
-
decay_rate: 0.99
|
|
281
|
-
rationale: |
|
|
282
|
-
Decay is disabled by default to maximize sample efficiency during
|
|
283
|
-
early learning. Enable after sufficient data (e.g., 100+ dispatches)
|
|
284
|
-
if the system needs to adapt to changing team composition or codebase.
|
|
285
|
-
|
|
286
|
-
validation:
|
|
287
|
-
description: "Sanity checks after each update"
|
|
288
|
-
rules:
|
|
289
|
-
- "alpha_success >= 1.0 (never below prior)"
|
|
290
|
-
- "alpha_failure >= 1.0 (never below prior)"
|
|
291
|
-
- "beliefs file is valid JSON after write"
|
|
292
|
-
- "backup file matches pre-update state"
|
|
293
|
-
|
|
294
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
295
|
-
# Section 5: Cold Start Handling
|
|
296
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
297
|
-
|
|
298
|
-
cold_start_handling:
|
|
299
|
-
description: |
|
|
300
|
-
The system needs sufficient observations before beliefs can meaningfully
|
|
301
|
-
influence formation selection. Below the threshold, the existing static
|
|
302
|
-
heuristic is used unchanged.
|
|
303
|
-
|
|
304
|
-
threshold:
|
|
305
|
-
minimum_dispatches: 10
|
|
306
|
-
scope: "global (total dispatches across all formations)"
|
|
307
|
-
rationale: |
|
|
308
|
-
With fewer than 10 dispatches, the Dirichlet posteriors are dominated
|
|
309
|
-
by the uniform prior (alpha=1). The expected probabilities hover near
|
|
310
|
-
0.5 regardless of outcomes. 10 dispatches provides enough signal for
|
|
311
|
-
at least some formation-task pairs to differentiate.
|
|
312
|
-
|
|
313
|
-
behavior_below_threshold:
|
|
314
|
-
description: |
|
|
315
|
-
Use the existing static heuristic without modification.
|
|
316
|
-
Beliefs are still updated (observations are still recorded), but
|
|
317
|
-
the EFE selection is not used for formation choice.
|
|
318
|
-
static_heuristic:
|
|
319
|
-
description: |
|
|
320
|
-
Current formation selection logic in dispatch.js:
|
|
321
|
-
- Default: unit (simplest, lowest overhead)
|
|
322
|
-
- Explicit --formation flag overrides everything
|
|
323
|
-
- Skill definitions may specify preferred formation
|
|
324
|
-
- Complexity-based: unit > solo > squad > legion
|
|
325
|
-
priority_order:
|
|
326
|
-
- unit # Default for most tasks
|
|
327
|
-
- solo # For tasks needing enhanced context
|
|
328
|
-
- squad # For parallelizable multi-file tasks
|
|
329
|
-
- legion # For large coordinated efforts
|
|
330
|
-
|
|
331
|
-
transition:
|
|
332
|
-
description: |
|
|
333
|
-
When total dispatches crosses the threshold, begin blending EFE
|
|
334
|
-
selection with the static heuristic using a linear ramp.
|
|
335
|
-
blend_formula: |
|
|
336
|
-
effective_weight = min(1.0, (total_dispatches - threshold) / ramp_length)
|
|
337
|
-
|
|
338
|
-
If effective_weight < 1.0:
|
|
339
|
-
score(f) = (1 - effective_weight) * static_score(f) + effective_weight * EFE(f, t)
|
|
340
|
-
Else:
|
|
341
|
-
score(f) = EFE(f, t)
|
|
342
|
-
ramp_length: 20
|
|
343
|
-
rationale: |
|
|
344
|
-
Linear ramp over 20 dispatches (from dispatch 10 to 30) provides a
|
|
345
|
-
smooth transition from static heuristic to learned beliefs. This
|
|
346
|
-
avoids sudden behavior changes when crossing the threshold.
|
|
347
|
-
static_score:
|
|
348
|
-
description: |
|
|
349
|
-
Numerical encoding of the static priority order for blending:
|
|
350
|
-
values:
|
|
351
|
-
unit: 1.0
|
|
352
|
-
solo: 0.75
|
|
353
|
-
squad: 0.5
|
|
354
|
-
legion: 0.25
|
|
355
|
-
|
|
356
|
-
override:
|
|
357
|
-
description: |
|
|
358
|
-
The --formation flag in dispatch.js ALWAYS takes precedence over
|
|
359
|
-
EFE selection, regardless of cold-start state or beliefs. This is
|
|
360
|
-
the user's escape hatch for manual control.
|
|
361
|
-
|
|
362
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
363
|
-
# Section 6: Integration Points
|
|
364
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
365
|
-
|
|
366
|
-
integration_points:
|
|
367
|
-
description: |
|
|
368
|
-
Where this system connects to existing Formation infrastructure.
|
|
369
|
-
|
|
370
|
-
dispatch_js:
|
|
371
|
-
file: ".formation/tools/dispatch.js"
|
|
372
|
-
change: |
|
|
373
|
-
In the dispatch() function (around line 229), after loading the skill
|
|
374
|
-
definition and before executing the formation, insert a formation
|
|
375
|
-
selection step:
|
|
376
|
-
|
|
377
|
-
1. If --formation flag is set → use it (no change)
|
|
378
|
-
2. Else → call selectFormation(taskType, beliefs) which:
|
|
379
|
-
a. Loads beliefs from .formation/specialist_beliefs.json
|
|
380
|
-
b. Checks cold-start threshold
|
|
381
|
-
c. If below threshold: return static heuristic result
|
|
382
|
-
d. If above threshold: compute EFE for each formation, return argmax
|
|
383
|
-
new_function: "selectFormation(taskType, beliefsPath)"
|
|
384
|
-
location: "New file: .formation/tools/formation-efe.js"
|
|
385
|
-
|
|
386
|
-
post_complete_js:
|
|
387
|
-
file: ".formation/tools/post-complete.js"
|
|
388
|
-
change: |
|
|
389
|
-
After task status is finalized (moved to done/ or blocked/), call
|
|
390
|
-
updateBeliefs(formation, taskType, outcome) to perform the Bayesian
|
|
391
|
-
posterior update.
|
|
392
|
-
new_function: "updateBeliefs(formation, taskType, outcome)"
|
|
393
|
-
location: "Same file: .formation/tools/formation-efe.js"
|
|
394
|
-
|
|
395
|
-
beliefs_file:
|
|
396
|
-
path: ".formation/specialist_beliefs.json"
|
|
397
|
-
lifecycle:
|
|
398
|
-
creation: "Auto-created with uniform priors on first dispatch after implementation"
|
|
399
|
-
updates: "After every dispatch completion via post-complete.js"
|
|
400
|
-
backup: "Before each update to .formation/specialist_beliefs.backup.json"
|
|
401
|
-
gitignore: "Add to .gitignore — beliefs are local/machine-specific"
|
|
402
|
-
|
|
403
|
-
task_type_detection:
|
|
404
|
-
description: |
|
|
405
|
-
Determine the task_type for a given dispatch. Used by both selectFormation
|
|
406
|
-
and updateBeliefs.
|
|
407
|
-
strategy: |
|
|
408
|
-
1. If task YAML has explicit `type` or `category` field → use it
|
|
409
|
-
2. If task has `role` field (e.g., "backend", "frontend") → map to task_type
|
|
410
|
-
3. If skill name contains keywords → infer (e.g., skill=synapse → "synapse")
|
|
411
|
-
4. Fallback → "backend" (most common task type)
|
|
412
|
-
mapping:
|
|
413
|
-
role_to_type:
|
|
414
|
-
backend: "backend"
|
|
415
|
-
frontend: "ui"
|
|
416
|
-
design: "ui"
|
|
417
|
-
synapse: "synapse"
|
|
418
|
-
spec: "spec"
|
|
419
|
-
fix: "fix"
|
|
420
|
-
sre: "backend"
|
|
421
|
-
|
|
422
|
-
monitoring:
|
|
423
|
-
description: |
|
|
424
|
-
Observability for the belief system to diagnose selection quality.
|
|
425
|
-
log_events:
|
|
426
|
-
- event: "formation_selected"
|
|
427
|
-
data: "{ taskType, selectedFormation, efeScores, belowThreshold }"
|
|
428
|
-
- event: "beliefs_updated"
|
|
429
|
-
data: "{ formation, taskType, outcome, newAlphas }"
|
|
430
|
-
log_location: ".formation/logs/ (existing log infrastructure)"
|
|
431
|
-
|
|
432
|
-
future_extensions:
|
|
433
|
-
description: |
|
|
434
|
-
Out of scope for this spec, but natural next steps:
|
|
435
|
-
items:
|
|
436
|
-
- title: "Per-specialist beliefs"
|
|
437
|
-
description: |
|
|
438
|
-
Extend from formation-level to specialist-level beliefs.
|
|
439
|
-
E.g., Ansuz might be better at spec tasks than backend tasks.
|
|
440
|
-
Requires specialist identity tracking in dispatch.
|
|
441
|
-
- title: "Multi-dimensional outcomes"
|
|
442
|
-
description: |
|
|
443
|
-
Replace binary success/failure with graded outcomes
|
|
444
|
-
(quality score, time-to-completion, retry count).
|
|
445
|
-
Requires Dirichlet over K>2 categories.
|
|
446
|
-
- title: "Cross-project transfer"
|
|
447
|
-
description: |
|
|
448
|
-
Share beliefs across projects with similar characteristics.
|
|
449
|
-
Requires a project similarity metric.
|
|
450
|
-
- title: "EFE weight learning"
|
|
451
|
-
description: |
|
|
452
|
-
Use the weight learning mechanism from efe.rs (TASK_960) to
|
|
453
|
-
automatically tune w_pragmatic and w_epistemic.
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
brief_version: "1.0"
|
|
2
|
-
task_id: TASK_1228
|
|
3
|
-
title: "Implement Bifrost UserPromptSubmit hook parity for per-turn context injection"
|
|
4
|
-
role: backend
|
|
5
|
-
produced_by: TASK_1234
|
|
6
|
-
|
|
7
|
-
# ─────────────────────────────────────────────────────────────────
|
|
8
|
-
# CGDD RECONCILIATION (read this first)
|
|
9
|
-
# ─────────────────────────────────────────────────────────────────
|
|
10
|
-
cgdd_note: >
|
|
11
|
-
CGDD_hook_lifecycle.js (produced by TASK_1232) labels phantom contracts by
|
|
12
|
-
task number, but those numbers were written before backlog was finalized.
|
|
13
|
-
CGDD TASK_1228 = SessionStart, CGDD TASK_1229 = UserPromptSubmit — these are
|
|
14
|
-
reversed from what the actual backlog says.
|
|
15
|
-
FOLLOW THIS BRIEF, NOT THE CGDD TASK NUMBER LABELS.
|
|
16
|
-
The phantom contract names (session_dispatchBifrostHook,
|
|
17
|
-
session_normalizeUserPromptSubmit) are correct — only the task number labels
|
|
18
|
-
inside CGDD are wrong.
|
|
19
|
-
|
|
20
|
-
cgdd_source: ".formation/bifrost/CGDD_hook_lifecycle.js"
|
|
21
|
-
lifecycle_contract_source: ".specialist/tools/task-bridge.js (BIFROST_HOOK_LIFECYCLE.UserPromptSubmit)"
|
|
22
|
-
|
|
23
|
-
# ─────────────────────────────────────────────────────────────────
|
|
24
|
-
# OBJECTIVE
|
|
25
|
-
# ─────────────────────────────────────────────────────────────────
|
|
26
|
-
objective: >
|
|
27
|
-
Add UserPromptSubmit hook emission to session.js so Codex specialists receive
|
|
28
|
-
per-turn context injection. This requires: (1) creating the dispatchBifrostHook()
|
|
29
|
-
utility in session.js (shared by TASK_1230), (2) creating normalizeUserPromptSubmit(),
|
|
30
|
-
(3) wiring the call site before relay.stdin.write(prompt).
|
|
31
|
-
|
|
32
|
-
# ─────────────────────────────────────────────────────────────────
|
|
33
|
-
# OWNED FILES — only touch these
|
|
34
|
-
# ─────────────────────────────────────────────────────────────────
|
|
35
|
-
owned_files:
|
|
36
|
-
primary: ".formation/bifrost/session.js"
|
|
37
|
-
read_for_contract: ".specialist/tools/task-bridge.js"
|
|
38
|
-
read_for_cgdd: ".formation/bifrost/CGDD_hook_lifecycle.js"
|
|
39
|
-
|
|
40
|
-
# ─────────────────────────────────────────────────────────────────
|
|
41
|
-
# NON-GOALS
|
|
42
|
-
# ─────────────────────────────────────────────────────────────────
|
|
43
|
-
non_goals:
|
|
44
|
-
- Do NOT implement SessionStart or Stop dispatch (TASK_1230 owns those)
|
|
45
|
-
- Do NOT modify relay.js (TASK_1229 owns PreToolUse/PostToolUse there)
|
|
46
|
-
- Do NOT modify task-bridge.js (handleHookEvent already handles UserPromptSubmit)
|
|
47
|
-
- Do NOT redefine the payload schema (it is frozen in BIFROST_HOOK_LIFECYCLE.UserPromptSubmit)
|
|
48
|
-
- Do NOT change the relay spawn command or its stdio settings (TASK_1230 owns that)
|
|
49
|
-
|
|
50
|
-
# ─────────────────────────────────────────────────────────────────
|
|
51
|
-
# WHAT TO CREATE IN session.js
|
|
52
|
-
# ─────────────────────────────────────────────────────────────────
|
|
53
|
-
functions_to_create:
|
|
54
|
-
- name: dispatchBifrostHook
|
|
55
|
-
signature: "function dispatchBifrostHook(eventName, payload)"
|
|
56
|
-
placement: "add near top of file, after SIGNAL_PATH constant (around line 41)"
|
|
57
|
-
require_statement: "const taskBridge = require(path.resolve(__dirname, '../..', '.specialist/tools/task-bridge.js'));"
|
|
58
|
-
body_skeleton: |
|
|
59
|
-
function dispatchBifrostHook(eventName, payload) {
|
|
60
|
-
try {
|
|
61
|
-
const taskBridge = require(path.resolve(__dirname, '../..', '.specialist/tools/task-bridge.js'));
|
|
62
|
-
taskBridge.handleHookEvent(payload);
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.error(`[bifrost] hook dispatch failed (${eventName}): ${err.message}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
error_policy: "catch + console.error — must never throw to caller"
|
|
68
|
-
shared_with: "TASK_1230 (SessionStart/Stop will reuse this same function)"
|
|
69
|
-
|
|
70
|
-
- name: normalizeUserPromptSubmit
|
|
71
|
-
signature: "function normalizeUserPromptSubmit(prompt)"
|
|
72
|
-
placement: "add after dispatchBifrostHook()"
|
|
73
|
-
returns: |
|
|
74
|
-
{
|
|
75
|
-
hook_event_name: 'UserPromptSubmit',
|
|
76
|
-
user_prompt: prompt,
|
|
77
|
-
prompt: prompt, // required alias — maybeEmitReminder() reads payload.prompt
|
|
78
|
-
text: prompt, // secondary alias
|
|
79
|
-
specialist: SPECIALIST,
|
|
80
|
-
session_id: RESUME_ID, // null for new sessions
|
|
81
|
-
cwd: CWD,
|
|
82
|
-
project_path: path.resolve(CWD),
|
|
83
|
-
submitted_at: new Date().toISOString(),
|
|
84
|
-
}
|
|
85
|
-
compat_critical: "prompt + user_prompt + text aliases are ALL required — maybeEmitReminder() in task-bridge.js reads payload.prompt"
|
|
86
|
-
|
|
87
|
-
# ─────────────────────────────────────────────────────────────────
|
|
88
|
-
# WIRING CALL SITE
|
|
89
|
-
# ─────────────────────────────────────────────────────────────────
|
|
90
|
-
call_site:
|
|
91
|
-
location: "session.js main execution block (bottom of file, lines ~246-260)"
|
|
92
|
-
current_code: |
|
|
93
|
-
if (RESUME_ID) {
|
|
94
|
-
writeSignal();
|
|
95
|
-
const userMsg = args._rest || 'Continue the session.';
|
|
96
|
-
launchRelay(userMsg);
|
|
97
|
-
} else {
|
|
98
|
-
const kernelPrompt = assemblePrompt();
|
|
99
|
-
const prompt = renderCodexAntiDrift() + kernelPrompt;
|
|
100
|
-
writeSignal();
|
|
101
|
-
launchRelay(prompt);
|
|
102
|
-
}
|
|
103
|
-
target_code: |
|
|
104
|
-
if (RESUME_ID) {
|
|
105
|
-
writeSignal();
|
|
106
|
-
const userMsg = args._rest || 'Continue the session.';
|
|
107
|
-
dispatchBifrostHook('UserPromptSubmit', normalizeUserPromptSubmit(userMsg));
|
|
108
|
-
launchRelay(userMsg);
|
|
109
|
-
} else {
|
|
110
|
-
const kernelPrompt = assemblePrompt();
|
|
111
|
-
const prompt = renderCodexAntiDrift() + kernelPrompt;
|
|
112
|
-
writeSignal();
|
|
113
|
-
dispatchBifrostHook('UserPromptSubmit', normalizeUserPromptSubmit(prompt));
|
|
114
|
-
launchRelay(prompt);
|
|
115
|
-
}
|
|
116
|
-
ordering_invariant: "UserPromptSubmit MUST fire after writeSignal() and BEFORE relay.stdin.write(prompt) (which launchRelay does internally)"
|
|
117
|
-
|
|
118
|
-
# ─────────────────────────────────────────────────────────────────
|
|
119
|
-
# INVARIANTS
|
|
120
|
-
# ─────────────────────────────────────────────────────────────────
|
|
121
|
-
invariants:
|
|
122
|
-
- "dispatchBifrostHook() must never throw — always wrap body in try/catch"
|
|
123
|
-
- "Exactly ONE UserPromptSubmit fires per session.js invocation"
|
|
124
|
-
- "payload.prompt must always be set (maybeEmitReminder depends on it)"
|
|
125
|
-
- "hook_event_name literal must be 'UserPromptSubmit' (handleHookEvent routes on this)"
|
|
126
|
-
- "project_path must always be set — use path.resolve(CWD) as minimum fallback"
|
|
127
|
-
|
|
128
|
-
# ─────────────────────────────────────────────────────────────────
|
|
129
|
-
# FORBIDDEN SHORTCUTS
|
|
130
|
-
# ─────────────────────────────────────────────────────────────────
|
|
131
|
-
forbidden:
|
|
132
|
-
- "Do NOT call dispatchBifrostHook via stdin pipe or child_process.exec — it must be a direct require() call"
|
|
133
|
-
- "Do NOT omit the prompt alias from the payload — the existing maybeEmitReminder() consumer reads payload.prompt, not payload.user_prompt"
|
|
134
|
-
- "Do NOT call dispatchBifrostHook inside launchRelay() — keep it at the call site boundary"
|
|
135
|
-
- "Do NOT change the session.js module structure or move existing constants"
|
|
136
|
-
|
|
137
|
-
# ─────────────────────────────────────────────────────────────────
|
|
138
|
-
# VERIFICATION COMMANDS (Phase 9 style)
|
|
139
|
-
# ─────────────────────────────────────────────────────────────────
|
|
140
|
-
verification:
|
|
141
|
-
grep_checks:
|
|
142
|
-
- desc: "dispatchBifrostHook function exists in session.js"
|
|
143
|
-
cmd: "grep -n 'function dispatchBifrostHook' .formation/bifrost/session.js"
|
|
144
|
-
expected: "one match at definition line"
|
|
145
|
-
|
|
146
|
-
- desc: "normalizeUserPromptSubmit function exists"
|
|
147
|
-
cmd: "grep -n 'function normalizeUserPromptSubmit' .formation/bifrost/session.js"
|
|
148
|
-
expected: "one match"
|
|
149
|
-
|
|
150
|
-
- desc: "UserPromptSubmit wired before launchRelay"
|
|
151
|
-
cmd: "grep -n 'UserPromptSubmit\\|launchRelay' .formation/bifrost/session.js"
|
|
152
|
-
expected: "dispatchBifrostHook('UserPromptSubmit'...) appears BEFORE launchRelay() on both code paths"
|
|
153
|
-
|
|
154
|
-
- desc: "payload.prompt alias present in normalizeUserPromptSubmit"
|
|
155
|
-
cmd: "grep -n 'prompt:.*prompt' .formation/bifrost/session.js"
|
|
156
|
-
expected: "at least one match inside normalizeUserPromptSubmit body"
|
|
157
|
-
|
|
158
|
-
- desc: "task-bridge require path is correct"
|
|
159
|
-
cmd: "grep -n 'task-bridge' .formation/bifrost/session.js"
|
|
160
|
-
expected: "path.resolve(__dirname, '../..', '.specialist/tools/task-bridge.js')"
|
|
161
|
-
|
|
162
|
-
integration_check:
|
|
163
|
-
desc: "Dry-run hook dispatch without Codex"
|
|
164
|
-
cmd: |
|
|
165
|
-
node -e "
|
|
166
|
-
process.env.NODE_ENV='test';
|
|
167
|
-
const path = require('path');
|
|
168
|
-
const tb = require('./.specialist/tools/task-bridge');
|
|
169
|
-
const payload = {
|
|
170
|
-
hook_event_name: 'UserPromptSubmit',
|
|
171
|
-
user_prompt: 'test prompt',
|
|
172
|
-
prompt: 'test prompt',
|
|
173
|
-
text: 'test prompt',
|
|
174
|
-
specialist: 'TestSpec',
|
|
175
|
-
session_id: null,
|
|
176
|
-
cwd: process.cwd(),
|
|
177
|
-
project_path: process.cwd(),
|
|
178
|
-
submitted_at: new Date().toISOString()
|
|
179
|
-
};
|
|
180
|
-
tb.handleHookEvent(payload).then(r => console.log('OK:', r)).catch(e => console.error('FAIL:', e.message));
|
|
181
|
-
"
|
|
182
|
-
expected: "OK: null (maybeEmitReminder fires but returns null in test context)"
|
|
183
|
-
|
|
184
|
-
# ─────────────────────────────────────────────────────────────────
|
|
185
|
-
# PREDECESSOR / SUCCESSOR
|
|
186
|
-
# ─────────────────────────────────────────────────────────────────
|
|
187
|
-
ordering:
|
|
188
|
-
this_task_creates: "dispatchBifrostHook() in session.js — TASK_1230 MUST NOT recreate it"
|
|
189
|
-
prerequisite_for: "TASK_1230 (Stop/SessionStart dispatch reuses dispatchBifrostHook)"
|
|
190
|
-
can_run_in_parallel_with: "TASK_1229 (relay.js only — no file overlap)"
|
|
191
|
-
must_complete_before: "TASK_1231 (verification gate)"
|