@brainforge/core 3.1.5 → 3.1.7

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 (3) hide show
  1. package/dist/index.d.ts +655 -3
  2. package/dist/index.js +4896 -1056
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { EventEmitter } from 'events';
2
2
 
3
- type ProjectType = 'student' | 'junior' | 'solo';
3
+ type ProjectType = 'student' | 'junior' | 'solo' | 'personal' | 'pro';
4
4
  type StudentLevel = 'beginner' | 'intermediate' | 'advanced';
5
- type Language = 'typescript' | 'javascript' | 'python' | 'java' | 'go' | 'php';
5
+ type Language = 'typescript' | 'javascript' | 'python' | 'java' | 'go' | 'php' | 'rust' | 'csharp' | 'ruby';
6
6
  type PhaseStatus = 'pending' | 'active' | 'completed' | 'blocked';
7
7
  type TaskStatus = 'todo' | 'in-progress' | 'done' | 'skipped';
8
+ type TaskPriority = 'low' | 'medium' | 'high' | 'critical';
9
+ type TaskType = 'backend' | 'frontend' | 'database' | 'devops' | 'security' | 'test' | 'docs' | 'general';
10
+ type BugSeverity = 'blocker' | 'high' | 'medium' | 'low';
11
+ type AgentId = 'orchestrator' | 'researcher' | 'codebase-mapper' | 'requirements-analyst' | 'architect' | 'planner' | 'backend-engineer' | 'frontend-engineer' | 'fullstack-engineer' | 'database-engineer' | 'devops-engineer' | 'security-reviewer' | 'test-engineer' | 'ui-reviewer' | 'debugger' | 'verifier' | 'docs-writer' | 'professor' | 'student-explainer' | 'ship-manager';
8
12
  interface ProjectConfig {
9
13
  name: string;
10
14
  description: string;
@@ -19,11 +23,61 @@ interface Task {
19
23
  title: string;
20
24
  description: string;
21
25
  status: TaskStatus;
26
+ priority: TaskPriority;
27
+ type?: TaskType;
22
28
  files?: string[];
29
+ agent?: AgentId;
30
+ parallelGroup?: string;
31
+ dependsOn?: string[];
32
+ acceptanceCriteria?: string[];
33
+ verificationCommands?: string[];
34
+ riskLevel?: 'low' | 'medium' | 'high';
23
35
  context?: Record<string, unknown>;
24
36
  createdAt: string;
25
37
  updatedAt: string;
26
38
  }
39
+ interface BugReport {
40
+ id: string;
41
+ phaseId: string;
42
+ title: string;
43
+ description: string;
44
+ severity: BugSeverity;
45
+ likelyFiles: string[];
46
+ suggestedFix: string;
47
+ status: 'open' | 'in-progress' | 'fixed' | 'wont-fix';
48
+ createdAt: string;
49
+ resolvedAt?: string;
50
+ }
51
+ interface AcceptanceCriterionResult {
52
+ criterion: string;
53
+ passed: boolean;
54
+ note?: string;
55
+ }
56
+ interface VerificationResult {
57
+ phaseId: string;
58
+ verifiedAt: string;
59
+ passed: boolean;
60
+ acceptanceCriteria: AcceptanceCriterionResult[];
61
+ bugs: BugReport[];
62
+ testsPassed: boolean;
63
+ buildPassed: boolean;
64
+ summary: string;
65
+ }
66
+ interface WaveGroup {
67
+ wave: number;
68
+ taskIds: string[];
69
+ canRunParallel: boolean;
70
+ conflicts: string[][];
71
+ }
72
+ interface RunRecord {
73
+ id: string;
74
+ phaseId?: string;
75
+ command: string;
76
+ startedAt: string;
77
+ completedAt?: string;
78
+ status: 'running' | 'completed' | 'failed';
79
+ dir: string;
80
+ }
27
81
  interface Phase {
28
82
  id: string;
29
83
  name: string;
@@ -53,6 +107,46 @@ interface BrainforgeState {
53
107
  };
54
108
  }
55
109
 
110
+ type WorkflowMode = 'student' | 'simple' | 'pro';
111
+ type RuntimeName = 'claude-code' | 'codex' | 'opencode' | 'gemini-cli' | 'cursor' | 'windsurf' | 'copilot' | 'vscode' | 'cline' | 'generic';
112
+ interface BrainForgeConfig {
113
+ version: number;
114
+ mode: WorkflowMode;
115
+ runtime: RuntimeName;
116
+ parallelization: {
117
+ enabled: boolean;
118
+ maxAgents: number;
119
+ };
120
+ automation: {
121
+ autoCommit: boolean;
122
+ verifyEachPhase: boolean;
123
+ shipEachPhase: boolean;
124
+ stopOnFailure: boolean;
125
+ };
126
+ memory: {
127
+ contextPacketMaxTokens: number;
128
+ summarizeAfterEachRun: boolean;
129
+ keepRawLogs: boolean;
130
+ };
131
+ student: {
132
+ enabled: boolean;
133
+ level: 'beginner' | 'intermediate' | 'advanced';
134
+ professorMode: boolean;
135
+ };
136
+ safety: {
137
+ redactSecrets: boolean;
138
+ requireCleanGit: boolean;
139
+ dryRunByDefault: boolean;
140
+ };
141
+ dashboard: {
142
+ enabled: boolean;
143
+ port: number;
144
+ };
145
+ }
146
+ declare const DEFAULT_CONFIG: BrainForgeConfig;
147
+ declare function loadConfig(cwd: string): Promise<BrainForgeConfig>;
148
+ declare function saveConfig(cwd: string, config: BrainForgeConfig): Promise<void>;
149
+
56
150
  declare class StateManager {
57
151
  private readonly workingDir;
58
152
  private statePath;
@@ -61,6 +155,8 @@ declare class StateManager {
61
155
  load(): Promise<BrainforgeState>;
62
156
  save(): Promise<void>;
63
157
  init(project: ProjectConfig): Promise<BrainforgeState>;
158
+ loadWorkspaceConfig(): Promise<BrainForgeConfig>;
159
+ saveWorkspaceConfig(config: BrainForgeConfig): Promise<void>;
64
160
  get(): BrainforgeState;
65
161
  set(updater: (state: BrainforgeState) => void): void;
66
162
  configureAI(config: AIConfig): Promise<void>;
@@ -72,7 +168,50 @@ declare class StateManager {
72
168
  private writeStateMd;
73
169
  }
74
170
 
171
+ declare class Workspace {
172
+ private readonly cwd;
173
+ readonly brainforgeDir: string;
174
+ constructor(cwd: string);
175
+ ensureDirectories(): Promise<void>;
176
+ loadConfig(): Promise<BrainForgeConfig>;
177
+ saveConfig(config: BrainForgeConfig): Promise<void>;
178
+ initConfig(overrides?: Partial<BrainForgeConfig>): Promise<BrainForgeConfig>;
179
+ configExists(): Promise<boolean>;
180
+ stateExists(): Promise<boolean>;
181
+ phasePath(phaseId: string): string;
182
+ memoryPath(): string;
183
+ codebasePath(): string;
184
+ runsPath(): string;
185
+ runPath(runId: string): string;
186
+ skillsPath(): string;
187
+ forensicsPath(): string;
188
+ ensurePhaseDir(phaseId: string): Promise<void>;
189
+ ensureRunDir(runId: string): Promise<void>;
190
+ private ensureInitialFiles;
191
+ }
192
+
193
+ interface MigrationResult {
194
+ ran: boolean;
195
+ actions: string[];
196
+ }
197
+ declare function detectAndMigrate(cwd: string): Promise<MigrationResult>;
198
+
199
+ interface ValidationResult {
200
+ valid: boolean;
201
+ errors: string[];
202
+ warnings: string[];
203
+ }
204
+ declare function validateConfig(config: unknown): ValidationResult;
205
+ declare function validatePhase(phase: unknown): ValidationResult;
206
+ declare function validateTask(task: unknown): ValidationResult;
207
+ declare function validateProjectConfig(config: unknown): ValidationResult;
208
+
75
209
  type StateAction = {
210
+ type: 'ADD_PHASE';
211
+ phase: Omit<Phase, 'completedAt' | 'description'> & {
212
+ description?: string;
213
+ };
214
+ } | {
76
215
  type: 'SET_ACTIVE_PHASE';
77
216
  phaseId: string;
78
217
  } | {
@@ -82,6 +221,10 @@ type StateAction = {
82
221
  type: 'UPDATE_TASK';
83
222
  taskId: string;
84
223
  updates: Partial<Task>;
224
+ } | {
225
+ type: 'UPDATE_TASK_STATUS';
226
+ taskId: string;
227
+ status: Task['status'];
85
228
  } | {
86
229
  type: 'SET_CONTEXT';
87
230
  key: string;
@@ -238,6 +381,10 @@ declare class BrainForgeServer {
238
381
  broadcast(type: string, payload: unknown): void;
239
382
  get url(): string;
240
383
  private handle;
384
+ private handleMemory;
385
+ private handleCodebase;
386
+ private handleAgents;
387
+ private handleRuntimes;
241
388
  private handleTaskStatus;
242
389
  private json;
243
390
  private fileJson;
@@ -392,4 +539,509 @@ declare class DeepSeekAdapter implements AIAdapter {
392
539
  complete(prompt: string, options?: CompletionOptions): Promise<string>;
393
540
  }
394
541
 
395
- export { type AIAdapter, type AIConfig, type AIProvider, AdapterManager, BUILT_IN_SKILLS, BrainForgeServer, type BrainforgeState, type ClassInfo, ClaudeAdapter, type CodebaseMap, CodebaseMapper, type CompletionOptions, type ContextField, DeepSeekAdapter, type DefenseAnswer, type DefenseSession, type DynamicQuestion, type FileChangeEvent, type FileNode, FileWatcher, type FunctionInfo, GeminiAdapter, type HeuristicPattern, type Language, MockDefense, OpenAIAdapter, type PatternMatch, type Phase, type PhaseStatus, type PlanAction, type PlanStep, ProfessorScanner, type ProjectConfig, type ProjectType, PromptEngine, type Question, type ScanReport, type Severity, type Skill, type SkillCategory, type SkillContext, SkillRegistry, type StateAction, StateManager, type StudentLevel, type Task, type TaskPlan, TaskPlanner, type TaskStatus, buildQuestionSet, reduce };
542
+ type RuntimeId = 'claude-code' | 'codex' | 'opencode' | 'gemini-cli' | 'cursor' | 'windsurf' | 'copilot' | 'vscode' | 'generic';
543
+ type RuntimeCapability = 'slash-commands' | 'rules' | 'snippets' | 'instructions';
544
+ interface RuntimeDefinition {
545
+ id: RuntimeId;
546
+ name: string;
547
+ commandPrefix: string;
548
+ globalConfigPath: string;
549
+ localConfigPath: string;
550
+ commandFileExt: string;
551
+ capabilities: RuntimeCapability[];
552
+ notes: string;
553
+ supportLevel: 'full' | 'partial' | 'fallback';
554
+ }
555
+ declare const RUNTIME_REGISTRY: RuntimeDefinition[];
556
+ declare function getRuntime(id: RuntimeId): RuntimeDefinition | undefined;
557
+ declare function listRuntimes(): RuntimeDefinition[];
558
+
559
+ interface DetectionResult {
560
+ id: RuntimeId;
561
+ name: string;
562
+ detected: boolean;
563
+ method?: string;
564
+ configPath?: string;
565
+ supportLevel: 'full' | 'partial' | 'fallback';
566
+ }
567
+ declare function detectRuntimes(cwd: string): Promise<DetectionResult[]>;
568
+
569
+ interface InstallResult {
570
+ runtimeId: RuntimeId;
571
+ runtimeName: string;
572
+ filesWritten: string[];
573
+ targetDir: string;
574
+ commandCount: number;
575
+ }
576
+ declare function installRuntime(runtimeId: RuntimeId, opts: {
577
+ global: boolean;
578
+ cwd: string;
579
+ }): Promise<InstallResult>;
580
+
581
+ interface CommandDef {
582
+ name: string;
583
+ description: string;
584
+ cliCommand: string;
585
+ instruction: string;
586
+ }
587
+ declare const COMMAND_DEFINITIONS: CommandDef[];
588
+ declare const COMMANDS_BY_NAME: Map<string, CommandDef>;
589
+
590
+ interface AgentContract {
591
+ id: AgentId;
592
+ name: string;
593
+ purpose: string;
594
+ inputs: string[];
595
+ outputs: string[];
596
+ forbidden: string[];
597
+ qualityChecks: string[];
598
+ taskTypes: string[];
599
+ }
600
+
601
+ declare const AGENT_REGISTRY: AgentContract[];
602
+ declare function getAgent(id: AgentId): AgentContract | undefined;
603
+ declare function listAgents(): AgentContract[];
604
+
605
+ interface Wave {
606
+ index: number;
607
+ label: string;
608
+ tasks: Task[];
609
+ canParallelize: boolean;
610
+ }
611
+ declare class WavePlanner {
612
+ plan(tasks: Task[]): Wave[];
613
+ assignAgents(tasks: Task[]): Map<string, AgentId>;
614
+ }
615
+
616
+ interface StackInfo {
617
+ language: string;
618
+ secondaryLanguages: string[];
619
+ framework?: string;
620
+ runtime?: string;
621
+ buildTool?: string;
622
+ linter?: string;
623
+ formatter?: string;
624
+ packageManager?: string;
625
+ cssFramework?: string;
626
+ }
627
+ declare function detectStack(cwd: string): Promise<StackInfo>;
628
+
629
+ interface OrchestratorResult {
630
+ waves: number;
631
+ totalTasks: number;
632
+ files: string[];
633
+ waveDir: string;
634
+ }
635
+ declare class ParallelOrchestrator {
636
+ private readonly cwd;
637
+ private readonly phasesDir;
638
+ constructor(cwd: string);
639
+ orchestrate(phase: Phase, stack?: StackInfo): Promise<OrchestratorResult>;
640
+ }
641
+
642
+ interface ConflictWarning {
643
+ taskA: string;
644
+ taskB: string;
645
+ reason: string;
646
+ filePaths?: string[];
647
+ }
648
+ declare function detectConflicts(tasks: Task[]): ConflictWarning[];
649
+
650
+ interface WaveResult {
651
+ waveIndex: number;
652
+ completedTaskIds: string[];
653
+ failedTaskIds: string[];
654
+ blockers: string[];
655
+ }
656
+ interface MergeReport {
657
+ totalWaves: number;
658
+ totalTasks: number;
659
+ completed: number;
660
+ failed: number;
661
+ blocked: boolean;
662
+ summary: string;
663
+ }
664
+ declare function mergeResults(waves: Wave[], results: WaveResult[]): MergeReport;
665
+ declare function buildMergeReport(tasks: Task[], results: WaveResult[]): string;
666
+
667
+ interface AgentPromptContext {
668
+ projectName: string;
669
+ phaseName: string;
670
+ stack?: StackInfo;
671
+ phaseGoal?: string;
672
+ }
673
+ declare function buildAgentPrompt(agent: AgentContract, task: Task, ctx: AgentPromptContext): string;
674
+ declare function buildWaveSummary(wave: number, tasks: Task[], phase: Phase, ctx: AgentPromptContext): string;
675
+
676
+ interface CreatePhaseInput {
677
+ id: string;
678
+ name: string;
679
+ description?: string;
680
+ tasks: Omit<Task, 'status'>[];
681
+ }
682
+ declare class WorkflowEngine {
683
+ buildCreatePhaseAction(input: CreatePhaseInput): StateAction;
684
+ buildSwitchPhaseAction(phaseId: string): StateAction;
685
+ buildStartTaskAction(taskId: string): StateAction;
686
+ buildCompleteTaskAction(taskId: string): StateAction;
687
+ buildCompletePhaseAction(phaseId: string): StateAction;
688
+ isPhaseComplete(phase: Phase): boolean;
689
+ getNextAction(state: BrainforgeState): string;
690
+ slugify(name: string): string;
691
+ generatePhaseId(name: string, existingIds: string[]): string;
692
+ }
693
+
694
+ interface PhaseStepStatus {
695
+ phaseId: string;
696
+ step: 'discussion' | 'plan' | 'execution' | 'verification' | 'shipped';
697
+ updatedAt: string;
698
+ }
699
+ declare class PhaseEngine {
700
+ private readonly cwd;
701
+ constructor(cwd: string);
702
+ phaseDir(phaseId: string): string;
703
+ ensurePhaseDir(phaseId: string): Promise<void>;
704
+ writeStatus(phaseId: string, step: PhaseStepStatus['step']): Promise<void>;
705
+ readStatus(phaseId: string): Promise<PhaseStepStatus | null>;
706
+ writeArtifact(phaseId: string, filename: string, content: string): Promise<string>;
707
+ readArtifact(phaseId: string, filename: string): Promise<string | null>;
708
+ listArtifacts(phaseId: string): Promise<string[]>;
709
+ relPath(phaseId: string, filename: string): string;
710
+ }
711
+
712
+ interface ConventionInfo {
713
+ namingStyle: 'camelCase' | 'snake_case' | 'kebab-case' | 'PascalCase' | 'mixed';
714
+ folderPattern: string;
715
+ moduleStyle: 'esm' | 'cjs' | 'mixed' | 'unknown';
716
+ typescriptStrict: boolean;
717
+ hasEditorConfig: boolean;
718
+ hasHusky: boolean;
719
+ hasLintStaged: boolean;
720
+ entryPoint?: string;
721
+ }
722
+ declare function detectConventions(cwd: string, files: string[]): Promise<ConventionInfo>;
723
+
724
+ interface ExecutionContext {
725
+ projectName: string;
726
+ stack?: StackInfo;
727
+ conventions?: ConventionInfo;
728
+ phaseGoal?: string;
729
+ }
730
+ interface TaskPrompt {
731
+ taskId: string;
732
+ taskTitle: string;
733
+ content: string;
734
+ }
735
+ declare class ExecutionEngine {
736
+ buildTaskPrompt(phase: Phase, task: Task, ctx: ExecutionContext): TaskPrompt;
737
+ buildPhasePrompt(phase: Phase, ctx: ExecutionContext): string;
738
+ buildDryRunSummary(phase: Phase): string;
739
+ }
740
+
741
+ interface BugEntry {
742
+ id: string;
743
+ title: string;
744
+ severity: 'critical' | 'major' | 'minor';
745
+ taskId?: string;
746
+ description?: string;
747
+ }
748
+ interface VerifyResult {
749
+ phaseId: string;
750
+ phaseName: string;
751
+ checkedAt: string;
752
+ totalCriteria: number;
753
+ passed: number;
754
+ bugs: BugEntry[];
755
+ blocked: boolean;
756
+ }
757
+ declare class VerificationEngine {
758
+ buildVerifyPrompt(phase: Phase, stack?: StackInfo): string;
759
+ buildVerifyMd(phase: Phase, bugs?: BugEntry[]): string;
760
+ buildBugsMd(bugs: BugEntry[]): string;
761
+ }
762
+
763
+ interface ShipResult {
764
+ phaseId: string;
765
+ phaseName: string;
766
+ shippedAt: string;
767
+ tasksCompleted: number;
768
+ memorySummary: string;
769
+ changelogEntry: string;
770
+ }
771
+ declare class ShipEngine {
772
+ build(phase: Phase, verifyPassed: boolean): ShipResult;
773
+ buildShipMd(phase: Phase, result: ShipResult): string;
774
+ buildMemorySummary(phase: Phase, shippedAt: string): string;
775
+ private buildChangelogEntry;
776
+ }
777
+
778
+ interface BugContext {
779
+ description: string;
780
+ errorMessage?: string;
781
+ reproSteps?: string;
782
+ expectedBehavior?: string;
783
+ actualBehavior?: string;
784
+ phaseId?: string;
785
+ }
786
+ interface DebugPlan {
787
+ bugId: string;
788
+ title: string;
789
+ hypotheses: string[];
790
+ filesToInspect: string[];
791
+ diagnosticCommands: string[];
792
+ prompt: string;
793
+ fixPlanPrompt: string;
794
+ }
795
+ declare class DebugEngine {
796
+ build(ctx: BugContext, phase: Phase | undefined, stack?: StackInfo): DebugPlan;
797
+ buildDebugsMd(plans: DebugPlan[]): string;
798
+ private buildDebugPrompt;
799
+ private buildFixPlanPrompt;
800
+ private generateHypotheses;
801
+ private inferRelevantFiles;
802
+ private buildDiagnosticCommands;
803
+ }
804
+
805
+ interface AutoStep {
806
+ step: number;
807
+ phaseId: string;
808
+ phaseName: string;
809
+ action: 'map' | 'execute' | 'verify' | 'ship';
810
+ description: string;
811
+ blocked: boolean;
812
+ blockReason?: string;
813
+ }
814
+ interface AutoPlan {
815
+ steps: AutoStep[];
816
+ totalPhases: number;
817
+ phasesToRun: number;
818
+ canRun: boolean;
819
+ blockers: string[];
820
+ estimatedPrompts: number;
821
+ }
822
+ interface AutoGates {
823
+ requireCleanGit: boolean;
824
+ stopOnFailure: boolean;
825
+ verifyEachPhase: boolean;
826
+ shipEachPhase: boolean;
827
+ }
828
+ declare class AutoEngine {
829
+ buildPlan(state: BrainforgeState, opts: {
830
+ fromPhaseId?: string;
831
+ toPhaseId?: string;
832
+ gates: AutoGates;
833
+ }): AutoPlan;
834
+ buildDryRunOutput(plan: AutoPlan): string;
835
+ buildAutoSummaryPrompt(plan: AutoPlan, state: BrainforgeState): string;
836
+ }
837
+
838
+ interface Dependency {
839
+ name: string;
840
+ version: string;
841
+ dev: boolean;
842
+ }
843
+ interface DependencyInfo {
844
+ runtime: Dependency[];
845
+ dev: Dependency[];
846
+ total: number;
847
+ manifestType: string;
848
+ highlights: string[];
849
+ }
850
+ declare function analyzeDependencies(cwd: string): Promise<DependencyInfo>;
851
+
852
+ type RiskLevel = 'high' | 'medium' | 'low';
853
+ interface RiskItem {
854
+ level: RiskLevel;
855
+ category: string;
856
+ message: string;
857
+ file?: string;
858
+ }
859
+ interface RiskInfo {
860
+ items: RiskItem[];
861
+ summary: {
862
+ high: number;
863
+ medium: number;
864
+ low: number;
865
+ };
866
+ }
867
+ declare function detectRisks(cwd: string, files: string[], fileContents: Map<string, string>): Promise<RiskInfo>;
868
+ declare function loadFileContents(cwd: string, files: string[], maxLines?: number): Promise<Map<string, string>>;
869
+
870
+ interface TestInfo {
871
+ framework?: string;
872
+ testFiles: string[];
873
+ testCount: number;
874
+ sourceFileCount: number;
875
+ coverageRatio: number;
876
+ hasConfig: boolean;
877
+ coverageEnabled: boolean;
878
+ testCommand?: string;
879
+ }
880
+ declare function detectTests(files: string[], deps: Record<string, string>, scripts?: Record<string, string>): TestInfo;
881
+
882
+ interface FileEntry {
883
+ path: string;
884
+ size: number;
885
+ lines: number;
886
+ role: string;
887
+ }
888
+ interface CodebaseMapResult {
889
+ generatedAt: string;
890
+ projectName: string;
891
+ stack: StackInfo;
892
+ dependencies: DependencyInfo;
893
+ conventions: ConventionInfo;
894
+ risks: RiskInfo;
895
+ tests: TestInfo;
896
+ files: FileEntry[];
897
+ totalFiles: number;
898
+ totalLines: number;
899
+ }
900
+ declare class CodebaseScanner {
901
+ private readonly cwd;
902
+ private readonly codebaseDir;
903
+ constructor(cwd: string);
904
+ scan(deep?: boolean): Promise<CodebaseMapResult>;
905
+ save(result: CodebaseMapResult): Promise<void>;
906
+ loadLatest(): Promise<CodebaseMapResult | null>;
907
+ private toMapMd;
908
+ private toConventionsMd;
909
+ private toRisksMd;
910
+ private toTestsMd;
911
+ private buildFileInventory;
912
+ private walkFiles;
913
+ private readProjectName;
914
+ }
915
+
916
+ type MemoryEntryType = 'decision' | 'summary' | 'gotcha' | 'pattern';
917
+ interface MemoryEntry {
918
+ id: string;
919
+ type: MemoryEntryType;
920
+ title: string;
921
+ content: string;
922
+ tags: string[];
923
+ phaseId?: string;
924
+ createdAt: string;
925
+ }
926
+ declare class MemoryStore {
927
+ private readonly cwd;
928
+ private readonly memoryDir;
929
+ constructor(cwd: string);
930
+ append(entry: Omit<MemoryEntry, 'id' | 'createdAt'> & {
931
+ id?: string;
932
+ createdAt?: string;
933
+ }): Promise<MemoryEntry>;
934
+ readAll(type?: MemoryEntryType): Promise<MemoryEntry[]>;
935
+ recent(type?: MemoryEntryType, limit?: number): Promise<MemoryEntry[]>;
936
+ search(query: string): Promise<MemoryEntry[]>;
937
+ count(): Promise<Record<MemoryEntryType, number>>;
938
+ overwrite(type: MemoryEntryType, entries: MemoryEntry[]): Promise<void>;
939
+ private readFile;
940
+ private updateIndex;
941
+ }
942
+
943
+ interface Decision {
944
+ title: string;
945
+ description: string;
946
+ rationale: string;
947
+ consequences?: string;
948
+ phaseId?: string;
949
+ tags?: string[];
950
+ }
951
+ declare class DecisionLogger {
952
+ private readonly store;
953
+ constructor(store: MemoryStore);
954
+ log(decision: Decision): Promise<MemoryEntry>;
955
+ list(): Promise<MemoryEntry[]>;
956
+ recent(limit?: number): Promise<MemoryEntry[]>;
957
+ }
958
+
959
+ interface Gotcha {
960
+ title: string;
961
+ description: string;
962
+ solution: string;
963
+ phaseId?: string;
964
+ tags?: string[];
965
+ }
966
+ declare class GotchaLogger {
967
+ private readonly store;
968
+ constructor(store: MemoryStore);
969
+ log(gotcha: Gotcha): Promise<MemoryEntry>;
970
+ list(): Promise<MemoryEntry[]>;
971
+ recent(limit?: number): Promise<MemoryEntry[]>;
972
+ }
973
+
974
+ interface CompactionResult {
975
+ type: MemoryEntryType;
976
+ before: number;
977
+ kept: number;
978
+ compacted: number;
979
+ }
980
+ interface CompactionReport {
981
+ ranAt: string;
982
+ results: CompactionResult[];
983
+ totalBefore: number;
984
+ totalAfter: number;
985
+ }
986
+ declare function compact(store: MemoryStore, keepLast?: number): Promise<CompactionReport>;
987
+
988
+ interface ContextPacket {
989
+ version: number;
990
+ generatedAt: string;
991
+ project: {
992
+ name: string;
993
+ language: string;
994
+ framework?: string;
995
+ type: string;
996
+ };
997
+ workflow: {
998
+ mode: string;
999
+ runtime: string;
1000
+ };
1001
+ phases: {
1002
+ total: number;
1003
+ completed: number;
1004
+ pending: number;
1005
+ activeId?: string;
1006
+ activeName?: string;
1007
+ };
1008
+ currentPhase?: {
1009
+ id: string;
1010
+ name: string;
1011
+ status: string;
1012
+ tasksTotal: number;
1013
+ tasksDone: number;
1014
+ tasksInProgress: number;
1015
+ nextTask?: string;
1016
+ };
1017
+ recentDecisions: Array<{
1018
+ title: string;
1019
+ content: string;
1020
+ createdAt: string;
1021
+ }>;
1022
+ knownGotchas: Array<{
1023
+ title: string;
1024
+ content: string;
1025
+ }>;
1026
+ recentSummaries: Array<{
1027
+ title: string;
1028
+ content: string;
1029
+ createdAt: string;
1030
+ }>;
1031
+ nextActions: string[];
1032
+ resumeCommands: string[];
1033
+ }
1034
+ declare class ContextPacketBuilder {
1035
+ private readonly cwd;
1036
+ private readonly packetDir;
1037
+ constructor(cwd: string);
1038
+ build(): Promise<ContextPacket>;
1039
+ save(packet: ContextPacket): Promise<{
1040
+ jsonPath: string;
1041
+ mdPath: string;
1042
+ }>;
1043
+ loadLatest(): Promise<ContextPacket | null>;
1044
+ toMarkdown(p: ContextPacket): string;
1045
+ }
1046
+
1047
+ export { AGENT_REGISTRY, type AIAdapter, type AIConfig, type AIProvider, type AcceptanceCriterionResult, AdapterManager, type AgentContract, type AgentId, type AgentPromptContext, AutoEngine, type AutoGates, type AutoPlan, type AutoStep, BUILT_IN_SKILLS, type BrainForgeConfig, BrainForgeServer, type BrainforgeState, type BugContext, type BugEntry, type BugReport, type BugSeverity, COMMANDS_BY_NAME, COMMAND_DEFINITIONS, type ClassInfo, ClaudeAdapter, type CodebaseMap, type CodebaseMapResult, CodebaseMapper, CodebaseScanner, type CommandDef, type CompactionReport, type CompactionResult, type CompletionOptions, type ConflictWarning, type ContextField, type ContextPacket, ContextPacketBuilder, type ConventionInfo, type CreatePhaseInput, DEFAULT_CONFIG, DebugEngine, type DebugPlan, type Decision, DecisionLogger, DeepSeekAdapter, type DefenseAnswer, type DefenseSession, type Dependency, type DependencyInfo, type DetectionResult, type DynamicQuestion, type ExecutionContext, ExecutionEngine, type FileChangeEvent, type FileEntry, type FileNode, FileWatcher, type FunctionInfo, GeminiAdapter, type Gotcha, GotchaLogger, type HeuristicPattern, type InstallResult, type Language, type MemoryEntry, type MemoryEntryType, MemoryStore, type MergeReport, type MigrationResult, MockDefense, OpenAIAdapter, type OrchestratorResult, ParallelOrchestrator, type PatternMatch, type Phase, PhaseEngine, type PhaseStatus, type PhaseStepStatus, type PlanAction, type PlanStep, ProfessorScanner, type ProjectConfig, type ProjectType, PromptEngine, type Question, RUNTIME_REGISTRY, type RiskInfo, type RiskItem, type RiskLevel, type RunRecord, type RuntimeCapability, type RuntimeDefinition, type RuntimeId, type RuntimeName, type ScanReport, type Severity, ShipEngine, type ShipResult, type Skill, type SkillCategory, type SkillContext, SkillRegistry, type StackInfo, type StateAction, StateManager, type StudentLevel, type Task, type TaskPlan, TaskPlanner, type TaskPriority, type TaskPrompt, type TaskStatus, type TaskType, type TestInfo, type ValidationResult, VerificationEngine, type VerificationResult, type VerifyResult, type Wave, type WaveGroup, WavePlanner, type WaveResult, WorkflowEngine, type WorkflowMode, Workspace, analyzeDependencies, buildAgentPrompt, buildMergeReport, buildQuestionSet, buildWaveSummary, compact, detectAndMigrate, detectConflicts, detectConventions, detectRisks, detectRuntimes, detectStack, detectTests, getAgent, getRuntime, installRuntime, listAgents, listRuntimes, loadConfig, loadFileContents, mergeResults, reduce, saveConfig, validateConfig, validatePhase, validateProjectConfig, validateTask };