@ornexus/neocortex 4.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +56 -0
- package/LICENSE-COMMERCIAL.md +70 -0
- package/README.md +58 -0
- package/dist/sbom.cdx.json +7067 -0
- package/docs/install/coderabbit-manual-setup.md +86 -0
- package/docs/install/installer-diagnostics.md +107 -0
- package/docs/install/linux-global-install.md +97 -0
- package/install.js +572 -0
- package/install.ps1 +2214 -0
- package/install.sh +2013 -0
- package/package.json +118 -0
- package/packages/client/dist/adapters/adapter-registry.d.ts +61 -0
- package/packages/client/dist/adapters/adapter-registry.js +1 -0
- package/packages/client/dist/adapters/antigravity-adapter.d.ts +18 -0
- package/packages/client/dist/adapters/antigravity-adapter.js +2 -0
- package/packages/client/dist/adapters/claude-code-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/claude-code-adapter.js +3 -0
- package/packages/client/dist/adapters/codex-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/codex-adapter.js +2 -0
- package/packages/client/dist/adapters/cursor-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/cursor-adapter.js +4 -0
- package/packages/client/dist/adapters/gemini-adapter.d.ts +18 -0
- package/packages/client/dist/adapters/gemini-adapter.js +2 -0
- package/packages/client/dist/adapters/index.d.ts +19 -0
- package/packages/client/dist/adapters/index.js +1 -0
- package/packages/client/dist/adapters/platform-detector.d.ts +48 -0
- package/packages/client/dist/adapters/platform-detector.js +1 -0
- package/packages/client/dist/adapters/target-adapter.d.ts +70 -0
- package/packages/client/dist/adapters/target-adapter.js +0 -0
- package/packages/client/dist/adapters/vscode-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/vscode-adapter.js +2 -0
- package/packages/client/dist/agent/refresh-stubs.d.ts +80 -0
- package/packages/client/dist/agent/refresh-stubs.js +2 -0
- package/packages/client/dist/agent/update-agent-yaml.d.ts +26 -0
- package/packages/client/dist/agent/update-agent-yaml.js +1 -0
- package/packages/client/dist/agent/update-description.d.ts +45 -0
- package/packages/client/dist/agent/update-description.js +1 -0
- package/packages/client/dist/cache/crypto-utils.d.ts +30 -0
- package/packages/client/dist/cache/crypto-utils.js +1 -0
- package/packages/client/dist/cache/encrypted-cache.d.ts +30 -0
- package/packages/client/dist/cache/encrypted-cache.js +1 -0
- package/packages/client/dist/cache/in-memory-asset-cache.d.ts +62 -0
- package/packages/client/dist/cache/in-memory-asset-cache.js +1 -0
- package/packages/client/dist/cache/index.d.ts +13 -0
- package/packages/client/dist/cache/index.js +1 -0
- package/packages/client/dist/cache/protected-pi-boundary.d.ts +19 -0
- package/packages/client/dist/cache/protected-pi-boundary.js +1 -0
- package/packages/client/dist/checkpoint/checkpoint-client-reader.d.ts +45 -0
- package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -0
- package/packages/client/dist/checkpoint/index.d.ts +12 -0
- package/packages/client/dist/checkpoint/index.js +1 -0
- package/packages/client/dist/checkpoint/shared-checkpoint-types.d.ts +85 -0
- package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -0
- package/packages/client/dist/cli.d.ts +14 -0
- package/packages/client/dist/cli.js +48 -0
- package/packages/client/dist/commands/activate.d.ts +55 -0
- package/packages/client/dist/commands/activate.js +8 -0
- package/packages/client/dist/commands/cache-status.d.ts +39 -0
- package/packages/client/dist/commands/cache-status.js +2 -0
- package/packages/client/dist/commands/invoke.d.ts +229 -0
- package/packages/client/dist/commands/invoke.js +63 -0
- package/packages/client/dist/commands/refresh-memory.d.ts +11 -0
- package/packages/client/dist/commands/refresh-memory.js +1 -0
- package/packages/client/dist/config/resolver-selection.d.ts +40 -0
- package/packages/client/dist/config/resolver-selection.js +1 -0
- package/packages/client/dist/config/secure-config.d.ts +78 -0
- package/packages/client/dist/config/secure-config.js +12 -0
- package/packages/client/dist/constants.d.ts +25 -0
- package/packages/client/dist/constants.js +1 -0
- package/packages/client/dist/context/context-collector.d.ts +28 -0
- package/packages/client/dist/context/context-collector.js +2 -0
- package/packages/client/dist/context/context-sanitizer.d.ts +28 -0
- package/packages/client/dist/context/context-sanitizer.js +1 -0
- package/packages/client/dist/continuity/continuity-client-state-store.d.ts +183 -0
- package/packages/client/dist/continuity/continuity-client-state-store.js +1 -0
- package/packages/client/dist/continuity/invoke-hooks.d.ts +18 -0
- package/packages/client/dist/continuity/invoke-hooks.js +1 -0
- package/packages/client/dist/continuity/migrations/001-initial-schema.d.ts +11 -0
- package/packages/client/dist/continuity/migrations/001-initial-schema.js +263 -0
- package/packages/client/dist/continuity/sqlite-store.d.ts +409 -0
- package/packages/client/dist/continuity/sqlite-store.js +226 -0
- package/packages/client/dist/errors/error-messages.d.ts +40 -0
- package/packages/client/dist/errors/error-messages.js +2 -0
- package/packages/client/dist/graph-retrieval/pre-command-hook.d.ts +31 -0
- package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -0
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.d.ts +77 -0
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -0
- package/packages/client/dist/i18n/first-run.d.ts +23 -0
- package/packages/client/dist/i18n/first-run.js +2 -0
- package/packages/client/dist/index.d.ts +56 -0
- package/packages/client/dist/index.js +1 -0
- package/packages/client/dist/license/index.d.ts +5 -0
- package/packages/client/dist/license/index.js +1 -0
- package/packages/client/dist/license/license-client.d.ts +79 -0
- package/packages/client/dist/license/license-client.js +1 -0
- package/packages/client/dist/machine/fingerprint.d.ts +34 -0
- package/packages/client/dist/machine/fingerprint.js +2 -0
- package/packages/client/dist/machine/index.d.ts +5 -0
- package/packages/client/dist/machine/index.js +1 -0
- package/packages/client/dist/memory/project-memory-writer.d.ts +74 -0
- package/packages/client/dist/memory/project-memory-writer.js +36 -0
- package/packages/client/dist/memory/shared-project-memory-types.d.ts +370 -0
- package/packages/client/dist/memory/shared-project-memory-types.js +2 -0
- package/packages/client/dist/policy/architecture-policy.d.ts +40 -0
- package/packages/client/dist/policy/architecture-policy.js +2 -0
- package/packages/client/dist/policy/index.d.ts +8 -0
- package/packages/client/dist/policy/index.js +1 -0
- package/packages/client/dist/policy/shared-policy-types.d.ts +89 -0
- package/packages/client/dist/policy/shared-policy-types.js +0 -0
- package/packages/client/dist/resilience/circuit-breaker.d.ts +70 -0
- package/packages/client/dist/resilience/circuit-breaker.js +1 -0
- package/packages/client/dist/resilience/degradation-manager.d.ts +67 -0
- package/packages/client/dist/resilience/degradation-manager.js +1 -0
- package/packages/client/dist/resilience/freshness-indicator.d.ts +59 -0
- package/packages/client/dist/resilience/freshness-indicator.js +1 -0
- package/packages/client/dist/resilience/index.d.ts +8 -0
- package/packages/client/dist/resilience/index.js +1 -0
- package/packages/client/dist/resilience/recovery-detector.d.ts +59 -0
- package/packages/client/dist/resilience/recovery-detector.js +1 -0
- package/packages/client/dist/resolvers/asset-resolver.d.ts +79 -0
- package/packages/client/dist/resolvers/asset-resolver.js +0 -0
- package/packages/client/dist/resolvers/local-resolver.d.ts +26 -0
- package/packages/client/dist/resolvers/local-resolver.js +8 -0
- package/packages/client/dist/resolvers/remote-resolver.d.ts +91 -0
- package/packages/client/dist/resolvers/remote-resolver.js +1 -0
- package/packages/client/dist/runner/cli.d.ts +121 -0
- package/packages/client/dist/runner/cli.js +20 -0
- package/packages/client/dist/runner/scheduler.d.ts +116 -0
- package/packages/client/dist/runner/scheduler.js +6 -0
- package/packages/client/dist/runner-cli.d.ts +9 -0
- package/packages/client/dist/runner-cli.js +3 -0
- package/packages/client/dist/state/project-state-snapshot.d.ts +15 -0
- package/packages/client/dist/state/project-state-snapshot.js +1 -0
- package/packages/client/dist/state/state-json-repair.d.ts +17 -0
- package/packages/client/dist/state/state-json-repair.js +3 -0
- package/packages/client/dist/telemetry/index.d.ts +5 -0
- package/packages/client/dist/telemetry/index.js +1 -0
- package/packages/client/dist/telemetry/offline-queue.d.ts +57 -0
- package/packages/client/dist/telemetry/offline-queue.js +1 -0
- package/packages/client/dist/tier/index.d.ts +5 -0
- package/packages/client/dist/tier/index.js +1 -0
- package/packages/client/dist/tier/tier-aware-client.d.ts +105 -0
- package/packages/client/dist/tier/tier-aware-client.js +1 -0
- package/packages/client/dist/types/index.d.ts +140 -0
- package/packages/client/dist/types/index.js +1 -0
- package/packages/client/dist/yoloop/discovery-hook.d.ts +85 -0
- package/packages/client/dist/yoloop/discovery-hook.js +2 -0
- package/packages/client/dist/yoloop/index.d.ts +10 -0
- package/packages/client/dist/yoloop/index.js +1 -0
- package/packages/client/dist/yoloop/invoke-hooks.d.ts +125 -0
- package/packages/client/dist/yoloop/invoke-hooks.js +5 -0
- package/packages/client/dist/yoloop/shared-discover-epics.d.ts +289 -0
- package/packages/client/dist/yoloop/shared-discover-epics.js +1 -0
- package/packages/client/dist/yoloop/shared-yoloop-types.d.ts +172 -0
- package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -0
- package/packages/client/dist/yoloop/yoloop-client-state-store.d.ts +124 -0
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -0
- package/postinstall.js +754 -0
- package/targets-stubs/antigravity/README.md +36 -0
- package/targets-stubs/antigravity/gemini.md +29 -0
- package/targets-stubs/antigravity/install-antigravity.sh +153 -0
- package/targets-stubs/antigravity/mcp-config.json +30 -0
- package/targets-stubs/antigravity/skill/SKILL.md +159 -0
- package/targets-stubs/claude-code/.mcp.json +32 -0
- package/targets-stubs/claude-code/README.md +20 -0
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +42 -0
- package/targets-stubs/claude-code/neocortex-root.md +310 -0
- package/targets-stubs/claude-code/neocortex.agent.yaml +42 -0
- package/targets-stubs/claude-code/neocortex.md +378 -0
- package/targets-stubs/codex/AGENTS.md +244 -0
- package/targets-stubs/codex/README.md +47 -0
- package/targets-stubs/codex/config-mcp.toml +22 -0
- package/targets-stubs/codex/install-codex.sh +63 -0
- package/targets-stubs/codex/neocortex.toml +29 -0
- package/targets-stubs/cursor/README.md +33 -0
- package/targets-stubs/cursor/agent.md +204 -0
- package/targets-stubs/cursor/install-cursor.sh +50 -0
- package/targets-stubs/cursor/mcp.json +30 -0
- package/targets-stubs/gemini-cli/README.md +34 -0
- package/targets-stubs/gemini-cli/agent.md +234 -0
- package/targets-stubs/gemini-cli/agents/neocortex.md +54 -0
- package/targets-stubs/gemini-cli/gemini.md +46 -0
- package/targets-stubs/gemini-cli/install-gemini.sh +70 -0
- package/targets-stubs/gemini-cli/settings-mcp.json +30 -0
- package/targets-stubs/kimi/mcp.json +33 -0
- package/targets-stubs/kimi/neocortex.md +54 -0
- package/targets-stubs/lib/mcp-merge.js +189 -0
- package/targets-stubs/openclaw/README.md +12 -0
- package/targets-stubs/openclaw/SKILL.md +88 -0
- package/targets-stubs/opencode/neocortex-root.md +261 -0
- package/targets-stubs/opencode/neocortex.md +59 -0
- package/targets-stubs/opencode/opencode-mcp.json +35 -0
- package/targets-stubs/vscode/README.md +34 -0
- package/targets-stubs/vscode/copilot-instructions.md +47 -0
- package/targets-stubs/vscode/install-vscode.sh +72 -0
- package/targets-stubs/vscode/mcp.json +36 -0
- package/targets-stubs/vscode/neocortex.agent.md +245 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P130.06: Client-side SSoT-Shadow mirror for project memory targets.
|
|
3
|
+
*
|
|
4
|
+
* The published client tarball must not import the workspace-only shared package
|
|
5
|
+
* at runtime. Keep this file in sync with `packages/shared/src/project-memory-*`
|
|
6
|
+
* and enforce drift through the P130.06 release tests.
|
|
7
|
+
*/
|
|
8
|
+
export type ProjectMemoryTargetId = 'canonical' | 'claude-code' | 'codex' | 'gemini-cli' | 'antigravity' | 'vscode' | 'cursor' | 'opencode' | 'openclaw' | 'kimi' | 'github-copilot-cli';
|
|
9
|
+
export type ProjectMemoryTemplateKind = 'neocortex-md' | 'claude-md' | 'agents-md' | 'gemini-md' | 'copilot-instructions' | 'cursor-rule';
|
|
10
|
+
export interface ProjectMemoryBudget {
|
|
11
|
+
readonly maxLines: number;
|
|
12
|
+
readonly maxBytes: number;
|
|
13
|
+
}
|
|
14
|
+
export type ProjectMemoryLinkPolicy = 'mandatory-semantic-symlink' | 'symlink-backed-wrapper' | 'safe-include-fallback';
|
|
15
|
+
export interface ProjectMemoryLinkRequirement {
|
|
16
|
+
readonly canonicalSource: typeof CANONICAL_PROJECT_MEMORY_SOURCE;
|
|
17
|
+
readonly semanticFileRequired: boolean;
|
|
18
|
+
readonly symlinkBacked: boolean;
|
|
19
|
+
readonly wrapperAllowed: boolean;
|
|
20
|
+
readonly includeFallbackAllowed: boolean;
|
|
21
|
+
readonly requiresWrapperPreservation: boolean;
|
|
22
|
+
readonly fallbackIsCompatibilityRemediation: boolean;
|
|
23
|
+
readonly policy: ProjectMemoryLinkPolicy;
|
|
24
|
+
readonly notes: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ProjectMemoryTarget {
|
|
27
|
+
readonly targetId: ProjectMemoryTargetId;
|
|
28
|
+
readonly platformName: string;
|
|
29
|
+
readonly canonicalSource: typeof CANONICAL_PROJECT_MEMORY_SOURCE;
|
|
30
|
+
readonly primaryFile: string;
|
|
31
|
+
readonly secondaryFiles: readonly string[];
|
|
32
|
+
readonly ownedBlockName: string;
|
|
33
|
+
readonly templateKind: ProjectMemoryTemplateKind;
|
|
34
|
+
readonly budget: ProjectMemoryBudget;
|
|
35
|
+
readonly linkRequirement: ProjectMemoryLinkRequirement;
|
|
36
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
37
|
+
readonly requiresWrapperPreservation: boolean;
|
|
38
|
+
readonly notes: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ProjectMemoryBidirectionalReference {
|
|
41
|
+
readonly canonicalSource: typeof CANONICAL_PROJECT_MEMORY_SOURCE;
|
|
42
|
+
readonly resolvesVia: ProjectMemoryLinkPolicy;
|
|
43
|
+
readonly feedbackTrigger: '*update-memory';
|
|
44
|
+
readonly guidance: string;
|
|
45
|
+
}
|
|
46
|
+
export type ArchitectureReferenceSource = 'architecture-root' | 'fallback-file';
|
|
47
|
+
export interface ArchitectureReference {
|
|
48
|
+
readonly path: string;
|
|
49
|
+
readonly title: string;
|
|
50
|
+
readonly purpose: string;
|
|
51
|
+
readonly suggestedUsage: string;
|
|
52
|
+
readonly source: ArchitectureReferenceSource;
|
|
53
|
+
}
|
|
54
|
+
export interface BootstrapArchitectureMemory {
|
|
55
|
+
readonly universalLaws?: readonly string[];
|
|
56
|
+
readonly businessContext?: readonly string[];
|
|
57
|
+
readonly activeContext?: readonly string[];
|
|
58
|
+
readonly repositoryMap?: readonly string[];
|
|
59
|
+
readonly environmentPractices?: readonly string[];
|
|
60
|
+
readonly platformMemoryContract?: readonly string[];
|
|
61
|
+
readonly maintenanceRules?: readonly string[];
|
|
62
|
+
readonly importantReferences?: readonly ArchitectureReference[];
|
|
63
|
+
readonly architectureReferences?: readonly ArchitectureReference[];
|
|
64
|
+
readonly heuristics?: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
export declare const CANONICAL_PROJECT_MEMORY_SOURCE: "NEOCORTEX.md";
|
|
67
|
+
export declare const PROJECT_MEMORY_TARGET_IDS: readonly ["claude-code", "codex", "gemini-cli", "antigravity", "vscode", "cursor", "opencode", "openclaw", "kimi", "github-copilot-cli"];
|
|
68
|
+
export declare const PROJECT_MEMORY_TARGETS: {
|
|
69
|
+
readonly canonical: {
|
|
70
|
+
readonly targetId: "canonical";
|
|
71
|
+
readonly platformName: "Neocortex Canonical Memory";
|
|
72
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
73
|
+
readonly primaryFile: "NEOCORTEX.md";
|
|
74
|
+
readonly secondaryFiles: readonly ["AGENTS.md", "CLAUDE.md", "GEMINI.md"];
|
|
75
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
76
|
+
readonly templateKind: "neocortex-md";
|
|
77
|
+
readonly budget: {
|
|
78
|
+
readonly maxLines: 220;
|
|
79
|
+
readonly maxBytes: 18000;
|
|
80
|
+
};
|
|
81
|
+
readonly linkRequirement: {
|
|
82
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
83
|
+
readonly semanticFileRequired: true;
|
|
84
|
+
readonly symlinkBacked: true;
|
|
85
|
+
readonly wrapperAllowed: false;
|
|
86
|
+
readonly includeFallbackAllowed: false;
|
|
87
|
+
readonly requiresWrapperPreservation: false;
|
|
88
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
89
|
+
readonly policy: "mandatory-semantic-symlink";
|
|
90
|
+
readonly notes: "Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter.";
|
|
91
|
+
};
|
|
92
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
93
|
+
readonly requiresWrapperPreservation: false;
|
|
94
|
+
readonly notes: "Canonical compact project memory source for platform symlinks and wrappers. Store only summaries, indexes, and links to architecture docs here.";
|
|
95
|
+
};
|
|
96
|
+
readonly 'claude-code': {
|
|
97
|
+
readonly targetId: "claude-code";
|
|
98
|
+
readonly platformName: "Claude Code";
|
|
99
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
100
|
+
readonly primaryFile: "CLAUDE.md";
|
|
101
|
+
readonly secondaryFiles: readonly [".claude/agents/neocortex.md"];
|
|
102
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
103
|
+
readonly templateKind: "claude-md";
|
|
104
|
+
readonly budget: {
|
|
105
|
+
readonly maxLines: 320;
|
|
106
|
+
readonly maxBytes: 28000;
|
|
107
|
+
};
|
|
108
|
+
readonly linkRequirement: {
|
|
109
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
110
|
+
readonly semanticFileRequired: true;
|
|
111
|
+
readonly symlinkBacked: true;
|
|
112
|
+
readonly wrapperAllowed: false;
|
|
113
|
+
readonly includeFallbackAllowed: false;
|
|
114
|
+
readonly requiresWrapperPreservation: false;
|
|
115
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
116
|
+
readonly policy: "mandatory-semantic-symlink";
|
|
117
|
+
readonly notes: "Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter.";
|
|
118
|
+
};
|
|
119
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
120
|
+
readonly requiresWrapperPreservation: false;
|
|
121
|
+
readonly notes: "Claude Code project memory. Resolve to NEOCORTEX.md; keep root content concise and link deeper docs with @path references.";
|
|
122
|
+
};
|
|
123
|
+
readonly codex: {
|
|
124
|
+
readonly targetId: "codex";
|
|
125
|
+
readonly platformName: "Codex CLI";
|
|
126
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
127
|
+
readonly primaryFile: "AGENTS.md";
|
|
128
|
+
readonly secondaryFiles: readonly [".codex/agents/neocortex.toml"];
|
|
129
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
130
|
+
readonly templateKind: "agents-md";
|
|
131
|
+
readonly budget: {
|
|
132
|
+
readonly maxLines: 220;
|
|
133
|
+
readonly maxBytes: 18000;
|
|
134
|
+
};
|
|
135
|
+
readonly linkRequirement: {
|
|
136
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
137
|
+
readonly semanticFileRequired: true;
|
|
138
|
+
readonly symlinkBacked: true;
|
|
139
|
+
readonly wrapperAllowed: false;
|
|
140
|
+
readonly includeFallbackAllowed: false;
|
|
141
|
+
readonly requiresWrapperPreservation: false;
|
|
142
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
143
|
+
readonly policy: "mandatory-semantic-symlink";
|
|
144
|
+
readonly notes: "Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter.";
|
|
145
|
+
};
|
|
146
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
147
|
+
readonly requiresWrapperPreservation: true;
|
|
148
|
+
readonly notes: "Codex root instructions. Uppercase AGENTS.md is required on case-sensitive filesystems.";
|
|
149
|
+
};
|
|
150
|
+
readonly 'gemini-cli': {
|
|
151
|
+
readonly targetId: "gemini-cli";
|
|
152
|
+
readonly platformName: "Gemini CLI";
|
|
153
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
154
|
+
readonly primaryFile: "GEMINI.md";
|
|
155
|
+
readonly secondaryFiles: readonly [".gemini/agents/neocortex.md"];
|
|
156
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
157
|
+
readonly templateKind: "gemini-md";
|
|
158
|
+
readonly budget: {
|
|
159
|
+
readonly maxLines: 260;
|
|
160
|
+
readonly maxBytes: 22000;
|
|
161
|
+
};
|
|
162
|
+
readonly linkRequirement: {
|
|
163
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
164
|
+
readonly semanticFileRequired: true;
|
|
165
|
+
readonly symlinkBacked: true;
|
|
166
|
+
readonly wrapperAllowed: false;
|
|
167
|
+
readonly includeFallbackAllowed: false;
|
|
168
|
+
readonly requiresWrapperPreservation: false;
|
|
169
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
170
|
+
readonly policy: "mandatory-semantic-symlink";
|
|
171
|
+
readonly notes: "Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter.";
|
|
172
|
+
};
|
|
173
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
174
|
+
readonly requiresWrapperPreservation: false;
|
|
175
|
+
readonly notes: "Gemini CLI context file. Prefer shallow @file.md imports for detailed architecture docs.";
|
|
176
|
+
};
|
|
177
|
+
readonly antigravity: {
|
|
178
|
+
readonly targetId: "antigravity";
|
|
179
|
+
readonly platformName: "Antigravity";
|
|
180
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
181
|
+
readonly primaryFile: "GEMINI.md";
|
|
182
|
+
readonly secondaryFiles: readonly [".gemini/agents/neocortex.md"];
|
|
183
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
184
|
+
readonly templateKind: "gemini-md";
|
|
185
|
+
readonly budget: {
|
|
186
|
+
readonly maxLines: 260;
|
|
187
|
+
readonly maxBytes: 22000;
|
|
188
|
+
};
|
|
189
|
+
readonly linkRequirement: {
|
|
190
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
191
|
+
readonly semanticFileRequired: true;
|
|
192
|
+
readonly symlinkBacked: true;
|
|
193
|
+
readonly wrapperAllowed: false;
|
|
194
|
+
readonly includeFallbackAllowed: false;
|
|
195
|
+
readonly requiresWrapperPreservation: false;
|
|
196
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
197
|
+
readonly policy: "mandatory-semantic-symlink";
|
|
198
|
+
readonly notes: "Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter.";
|
|
199
|
+
};
|
|
200
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
201
|
+
readonly requiresWrapperPreservation: false;
|
|
202
|
+
readonly notes: "Antigravity currently shares GEMINI.md behavior with the Gemini target stubs.";
|
|
203
|
+
};
|
|
204
|
+
readonly vscode: {
|
|
205
|
+
readonly targetId: "vscode";
|
|
206
|
+
readonly platformName: "VS Code / GitHub Copilot";
|
|
207
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
208
|
+
readonly primaryFile: ".github/copilot-instructions.md";
|
|
209
|
+
readonly secondaryFiles: readonly [".github/instructions/neocortex.instructions.md", ".github/agents/neocortex.agent.md"];
|
|
210
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
211
|
+
readonly templateKind: "copilot-instructions";
|
|
212
|
+
readonly budget: {
|
|
213
|
+
readonly maxLines: 180;
|
|
214
|
+
readonly maxBytes: 14000;
|
|
215
|
+
};
|
|
216
|
+
readonly linkRequirement: {
|
|
217
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
218
|
+
readonly semanticFileRequired: true;
|
|
219
|
+
readonly symlinkBacked: true;
|
|
220
|
+
readonly wrapperAllowed: true;
|
|
221
|
+
readonly includeFallbackAllowed: false;
|
|
222
|
+
readonly requiresWrapperPreservation: true;
|
|
223
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
224
|
+
readonly policy: "symlink-backed-wrapper";
|
|
225
|
+
readonly notes: "Platform wrapper/frontmatter is allowed only when the semantic memory payload remains symlink-backed by NEOCORTEX.md.";
|
|
226
|
+
};
|
|
227
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
228
|
+
readonly requiresWrapperPreservation: true;
|
|
229
|
+
readonly notes: "VS Code and GitHub Copilot always-on repository instructions.";
|
|
230
|
+
};
|
|
231
|
+
readonly cursor: {
|
|
232
|
+
readonly targetId: "cursor";
|
|
233
|
+
readonly platformName: "Cursor";
|
|
234
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
235
|
+
readonly primaryFile: ".cursor/rules/neocortex.mdc";
|
|
236
|
+
readonly secondaryFiles: readonly ["AGENTS.md"];
|
|
237
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
238
|
+
readonly templateKind: "cursor-rule";
|
|
239
|
+
readonly budget: {
|
|
240
|
+
readonly maxLines: 180;
|
|
241
|
+
readonly maxBytes: 14000;
|
|
242
|
+
};
|
|
243
|
+
readonly linkRequirement: {
|
|
244
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
245
|
+
readonly semanticFileRequired: true;
|
|
246
|
+
readonly symlinkBacked: true;
|
|
247
|
+
readonly wrapperAllowed: true;
|
|
248
|
+
readonly includeFallbackAllowed: false;
|
|
249
|
+
readonly requiresWrapperPreservation: true;
|
|
250
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
251
|
+
readonly policy: "symlink-backed-wrapper";
|
|
252
|
+
readonly notes: "Platform wrapper/frontmatter is allowed only when the semantic memory payload remains symlink-backed by NEOCORTEX.md.";
|
|
253
|
+
};
|
|
254
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
255
|
+
readonly requiresWrapperPreservation: true;
|
|
256
|
+
readonly notes: "Cursor rule memory. Use AGENTS.md as compatibility fallback when Cursor rules are absent.";
|
|
257
|
+
};
|
|
258
|
+
readonly opencode: {
|
|
259
|
+
readonly targetId: "opencode";
|
|
260
|
+
readonly platformName: "OpenCode";
|
|
261
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
262
|
+
readonly primaryFile: "AGENTS.md";
|
|
263
|
+
readonly secondaryFiles: readonly [".opencode/AGENTS.md", ".opencode/agents/neocortex-root.md", ".opencode/agents/neocortex.md", ".agent/skills/neocortex/SKILL.md"];
|
|
264
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
265
|
+
readonly templateKind: "agents-md";
|
|
266
|
+
readonly budget: {
|
|
267
|
+
readonly maxLines: 220;
|
|
268
|
+
readonly maxBytes: 18000;
|
|
269
|
+
};
|
|
270
|
+
readonly linkRequirement: {
|
|
271
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
272
|
+
readonly semanticFileRequired: true;
|
|
273
|
+
readonly symlinkBacked: true;
|
|
274
|
+
readonly wrapperAllowed: false;
|
|
275
|
+
readonly includeFallbackAllowed: false;
|
|
276
|
+
readonly requiresWrapperPreservation: false;
|
|
277
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
278
|
+
readonly policy: "mandatory-semantic-symlink";
|
|
279
|
+
readonly notes: "Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter.";
|
|
280
|
+
};
|
|
281
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
282
|
+
readonly requiresWrapperPreservation: true;
|
|
283
|
+
readonly notes: "OpenCode agent memory. It consumes AGENTS.md-compatible instructions and must resolve to canonical NEOCORTEX.md.";
|
|
284
|
+
};
|
|
285
|
+
readonly openclaw: {
|
|
286
|
+
readonly targetId: "openclaw";
|
|
287
|
+
readonly platformName: "OpenClaw";
|
|
288
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
289
|
+
readonly primaryFile: ".openclaw/skills/neocortex/SKILL.md";
|
|
290
|
+
readonly secondaryFiles: readonly ["~/.openclaw/skills/neocortex/SKILL.md"];
|
|
291
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
292
|
+
readonly templateKind: "agents-md";
|
|
293
|
+
readonly budget: {
|
|
294
|
+
readonly maxLines: 220;
|
|
295
|
+
readonly maxBytes: 18000;
|
|
296
|
+
};
|
|
297
|
+
readonly linkRequirement: {
|
|
298
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
299
|
+
readonly semanticFileRequired: true;
|
|
300
|
+
readonly symlinkBacked: true;
|
|
301
|
+
readonly wrapperAllowed: true;
|
|
302
|
+
readonly includeFallbackAllowed: true;
|
|
303
|
+
readonly requiresWrapperPreservation: true;
|
|
304
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
305
|
+
readonly policy: "safe-include-fallback";
|
|
306
|
+
readonly notes: "Use a safe include/import only for platforms that cannot consume symlinks directly; the include must resolve back to NEOCORTEX.md.";
|
|
307
|
+
};
|
|
308
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
309
|
+
readonly requiresWrapperPreservation: true;
|
|
310
|
+
readonly notes: "OpenClaw Skill thin-client memory entrypoint. Use the project Skill path when --create-project is requested; do not mutate ~/.openclaw/openclaw.json, and keep memory content public-safe.";
|
|
311
|
+
};
|
|
312
|
+
readonly kimi: {
|
|
313
|
+
readonly targetId: "kimi";
|
|
314
|
+
readonly platformName: "Kimi";
|
|
315
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
316
|
+
readonly primaryFile: "KIMI.md";
|
|
317
|
+
readonly secondaryFiles: readonly ["AGENTS.md", ".kimi/skills/neocortex/SKILL.md"];
|
|
318
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
319
|
+
readonly templateKind: "agents-md";
|
|
320
|
+
readonly budget: {
|
|
321
|
+
readonly maxLines: 220;
|
|
322
|
+
readonly maxBytes: 18000;
|
|
323
|
+
};
|
|
324
|
+
readonly linkRequirement: {
|
|
325
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
326
|
+
readonly semanticFileRequired: true;
|
|
327
|
+
readonly symlinkBacked: true;
|
|
328
|
+
readonly wrapperAllowed: true;
|
|
329
|
+
readonly includeFallbackAllowed: true;
|
|
330
|
+
readonly requiresWrapperPreservation: true;
|
|
331
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
332
|
+
readonly policy: "safe-include-fallback";
|
|
333
|
+
readonly notes: "Use a safe include/import only for platforms that cannot consume symlinks directly; the include must resolve back to NEOCORTEX.md.";
|
|
334
|
+
};
|
|
335
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
336
|
+
readonly requiresWrapperPreservation: true;
|
|
337
|
+
readonly notes: "Kimi memory entrypoint. Prefer a symlink to NEOCORTEX.md; use a compact include only if the host cannot follow symlinks.";
|
|
338
|
+
};
|
|
339
|
+
readonly 'github-copilot-cli': {
|
|
340
|
+
readonly targetId: "github-copilot-cli";
|
|
341
|
+
readonly platformName: "GitHub Copilot CLI / gh alias";
|
|
342
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
343
|
+
readonly primaryFile: ".github/copilot-instructions.md";
|
|
344
|
+
readonly secondaryFiles: readonly ["AGENTS.md"];
|
|
345
|
+
readonly ownedBlockName: "NEOCORTEX-MEMORY";
|
|
346
|
+
readonly templateKind: "copilot-instructions";
|
|
347
|
+
readonly budget: {
|
|
348
|
+
readonly maxLines: 180;
|
|
349
|
+
readonly maxBytes: 14000;
|
|
350
|
+
};
|
|
351
|
+
readonly linkRequirement: {
|
|
352
|
+
readonly canonicalSource: "NEOCORTEX.md";
|
|
353
|
+
readonly semanticFileRequired: true;
|
|
354
|
+
readonly symlinkBacked: true;
|
|
355
|
+
readonly wrapperAllowed: true;
|
|
356
|
+
readonly includeFallbackAllowed: true;
|
|
357
|
+
readonly requiresWrapperPreservation: true;
|
|
358
|
+
readonly fallbackIsCompatibilityRemediation: true;
|
|
359
|
+
readonly policy: "safe-include-fallback";
|
|
360
|
+
readonly notes: "Use a safe include/import only for platforms that cannot consume symlinks directly; the include must resolve back to NEOCORTEX.md.";
|
|
361
|
+
};
|
|
362
|
+
readonly bidirectionalReference: ProjectMemoryBidirectionalReference;
|
|
363
|
+
readonly requiresWrapperPreservation: true;
|
|
364
|
+
readonly notes: "GitHub Copilot CLI or gh alias instructions. Resolve compact memory back to NEOCORTEX.md without copying private prompt bodies.";
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
export declare function getProjectMemoryTarget(targetId: ProjectMemoryTargetId): ProjectMemoryTarget;
|
|
368
|
+
export declare function isProjectMemoryTargetId(value: string): value is ProjectMemoryTargetId;
|
|
369
|
+
export declare function listProjectMemoryTargets(): readonly ProjectMemoryTarget[];
|
|
370
|
+
export declare function renderArchitectureReferenceTable(references: readonly ArchitectureReference[]): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e="NEOCORTEX.md",r={canonicalSource:e,semanticFileRequired:!0,symlinkBacked:!0,wrapperAllowed:!1,includeFallbackAllowed:!1,requiresWrapperPreservation:!1,fallbackIsCompatibilityRemediation:!0,policy:"mandatory-semantic-symlink",notes:"Semantic platform memory file must resolve to NEOCORTEX.md through a symlink; do not replace it with an unrelated wrapper or copied frontmatter."},c={canonicalSource:e,semanticFileRequired:!0,symlinkBacked:!0,wrapperAllowed:!0,includeFallbackAllowed:!1,requiresWrapperPreservation:!0,fallbackIsCompatibilityRemediation:!0,policy:"symlink-backed-wrapper",notes:"Platform wrapper/frontmatter is allowed only when the semantic memory payload remains symlink-backed by NEOCORTEX.md."},a={canonicalSource:e,semanticFileRequired:!0,symlinkBacked:!0,wrapperAllowed:!0,includeFallbackAllowed:!0,requiresWrapperPreservation:!0,fallbackIsCompatibilityRemediation:!0,policy:"safe-include-fallback",notes:"Use a safe include/import only for platforms that cannot consume symlinks directly; the include must resolve back to NEOCORTEX.md."};function t(o){return{canonicalSource:e,resolvesVia:o.policy,feedbackTrigger:"*update-memory",guidance:"Treat NEOCORTEX.md as canonical project memory; consult it before platform-specific memory, and run *update-memory when durable project context changes should flow back to the canonical source."}}const l=["claude-code","codex","gemini-cli","antigravity","vscode","cursor","opencode","openclaw","kimi","github-copilot-cli"],s={canonical:{targetId:"canonical",platformName:"Neocortex Canonical Memory",canonicalSource:e,primaryFile:e,secondaryFiles:["AGENTS.md","CLAUDE.md","GEMINI.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"neocortex-md",budget:{maxLines:220,maxBytes:18e3},linkRequirement:r,bidirectionalReference:t(r),requiresWrapperPreservation:!1,notes:"Canonical compact project memory source for platform symlinks and wrappers. Store only summaries, indexes, and links to architecture docs here."},"claude-code":{targetId:"claude-code",platformName:"Claude Code",canonicalSource:e,primaryFile:"CLAUDE.md",secondaryFiles:[".claude/agents/neocortex.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"claude-md",budget:{maxLines:320,maxBytes:28e3},linkRequirement:r,bidirectionalReference:t(r),requiresWrapperPreservation:!1,notes:"Claude Code project memory. Resolve to NEOCORTEX.md; keep root content concise and link deeper docs with @path references."},codex:{targetId:"codex",platformName:"Codex CLI",canonicalSource:e,primaryFile:"AGENTS.md",secondaryFiles:[".codex/agents/neocortex.toml"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"agents-md",budget:{maxLines:220,maxBytes:18e3},linkRequirement:r,bidirectionalReference:t(r),requiresWrapperPreservation:!0,notes:"Codex root instructions. Uppercase AGENTS.md is required on case-sensitive filesystems."},"gemini-cli":{targetId:"gemini-cli",platformName:"Gemini CLI",canonicalSource:e,primaryFile:"GEMINI.md",secondaryFiles:[".gemini/agents/neocortex.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"gemini-md",budget:{maxLines:260,maxBytes:22e3},linkRequirement:r,bidirectionalReference:t(r),requiresWrapperPreservation:!1,notes:"Gemini CLI context file. Prefer shallow @file.md imports for detailed architecture docs."},antigravity:{targetId:"antigravity",platformName:"Antigravity",canonicalSource:e,primaryFile:"GEMINI.md",secondaryFiles:[".gemini/agents/neocortex.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"gemini-md",budget:{maxLines:260,maxBytes:22e3},linkRequirement:r,bidirectionalReference:t(r),requiresWrapperPreservation:!1,notes:"Antigravity currently shares GEMINI.md behavior with the Gemini target stubs."},vscode:{targetId:"vscode",platformName:"VS Code / GitHub Copilot",canonicalSource:e,primaryFile:".github/copilot-instructions.md",secondaryFiles:[".github/instructions/neocortex.instructions.md",".github/agents/neocortex.agent.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"copilot-instructions",budget:{maxLines:180,maxBytes:14e3},linkRequirement:c,bidirectionalReference:t(c),requiresWrapperPreservation:!0,notes:"VS Code and GitHub Copilot always-on repository instructions."},cursor:{targetId:"cursor",platformName:"Cursor",canonicalSource:e,primaryFile:".cursor/rules/neocortex.mdc",secondaryFiles:["AGENTS.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"cursor-rule",budget:{maxLines:180,maxBytes:14e3},linkRequirement:c,bidirectionalReference:t(c),requiresWrapperPreservation:!0,notes:"Cursor rule memory. Use AGENTS.md as compatibility fallback when Cursor rules are absent."},opencode:{targetId:"opencode",platformName:"OpenCode",canonicalSource:e,primaryFile:"AGENTS.md",secondaryFiles:[".opencode/AGENTS.md",".opencode/agents/neocortex-root.md",".opencode/agents/neocortex.md",".agent/skills/neocortex/SKILL.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"agents-md",budget:{maxLines:220,maxBytes:18e3},linkRequirement:r,bidirectionalReference:t(r),requiresWrapperPreservation:!0,notes:"OpenCode agent memory. It consumes AGENTS.md-compatible instructions and must resolve to canonical NEOCORTEX.md."},openclaw:{targetId:"openclaw",platformName:"OpenClaw",canonicalSource:e,primaryFile:".openclaw/skills/neocortex/SKILL.md",secondaryFiles:["~/.openclaw/skills/neocortex/SKILL.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"agents-md",budget:{maxLines:220,maxBytes:18e3},linkRequirement:a,bidirectionalReference:t(a),requiresWrapperPreservation:!0,notes:"OpenClaw Skill thin-client memory entrypoint. Use the project Skill path when --create-project is requested; do not mutate ~/.openclaw/openclaw.json, and keep memory content public-safe."},kimi:{targetId:"kimi",platformName:"Kimi",canonicalSource:e,primaryFile:"KIMI.md",secondaryFiles:["AGENTS.md",".kimi/skills/neocortex/SKILL.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"agents-md",budget:{maxLines:220,maxBytes:18e3},linkRequirement:a,bidirectionalReference:t(a),requiresWrapperPreservation:!0,notes:"Kimi memory entrypoint. Prefer a symlink to NEOCORTEX.md; use a compact include only if the host cannot follow symlinks."},"github-copilot-cli":{targetId:"github-copilot-cli",platformName:"GitHub Copilot CLI / gh alias",canonicalSource:e,primaryFile:".github/copilot-instructions.md",secondaryFiles:["AGENTS.md"],ownedBlockName:"NEOCORTEX-MEMORY",templateKind:"copilot-instructions",budget:{maxLines:180,maxBytes:14e3},linkRequirement:a,bidirectionalReference:t(a),requiresWrapperPreservation:!0,notes:"GitHub Copilot CLI or gh alias instructions. Resolve compact memory back to NEOCORTEX.md without copying private prompt bodies."}};function d(o){return s[o]}function p(o){return o==="canonical"||l.includes(o)}function u(){return l.map(o=>s[o])}function y(o){const n=i=>i.replace(/\|/g,"\\|").replace(/\n/g," ");return["| Path | Title | Purpose | Suggested Usage |","| --- | --- | --- | --- |",...o.map(i=>`| ${n(i.path)} | ${n(i.title)} | ${n(i.purpose)} | ${n(i.suggestedUsage)} |`)].join(`
|
|
2
|
+
`)}export{e as CANONICAL_PROJECT_MEMORY_SOURCE,s as PROJECT_MEMORY_TARGETS,l as PROJECT_MEMORY_TARGET_IDS,d as getProjectMemoryTarget,p as isProjectMemoryTargetId,u as listProjectMemoryTargets,y as renderArchitectureReferenceTable};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Neocortex CLI, licensed under the
|
|
6
|
+
* Functional Source License, Version 1.1 (FSL-1.1).
|
|
7
|
+
*
|
|
8
|
+
* Change Date: February 20, 2029
|
|
9
|
+
* Change License: MIT
|
|
10
|
+
*
|
|
11
|
+
* See the LICENSE file in the project root for full license text.
|
|
12
|
+
*/
|
|
13
|
+
import type { ArchitecturePolicy, ArchitecturePolicyValidationResult } from './shared-policy-types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Relative path from project root to consumer policy file.
|
|
16
|
+
* Consumer copies `architecture-policy.template.json` (from repo root) to
|
|
17
|
+
* this path and edits.
|
|
18
|
+
*/
|
|
19
|
+
export declare const POLICY_FILE_PATH = ".neocortex/architecture-policy.json";
|
|
20
|
+
/**
|
|
21
|
+
* Pure function validator. Zero I/O. Deterministic.
|
|
22
|
+
*
|
|
23
|
+
* Returns `ArchitecturePolicyValidationResult` with:
|
|
24
|
+
* - `valid: true` iff all required fields correct and no hard errors
|
|
25
|
+
* - `errors`: hard failures (schema version mismatch, bad mode, type errors)
|
|
26
|
+
* - `warnings`: soft issues (unknown optional fields -- forward-compat)
|
|
27
|
+
*/
|
|
28
|
+
export declare function validatePolicy(candidate: unknown): ArchitecturePolicyValidationResult;
|
|
29
|
+
/**
|
|
30
|
+
* Async reader. NEVER throws.
|
|
31
|
+
*
|
|
32
|
+
* Returns `undefined` when:
|
|
33
|
+
* - file does not exist (ENOENT; silent, expected default)
|
|
34
|
+
* - permission denied (EACCES; warns stderr)
|
|
35
|
+
* - malformed JSON (warns stderr with path)
|
|
36
|
+
* - schema invalid (warns stderr with error list)
|
|
37
|
+
*
|
|
38
|
+
* Returns typed `ArchitecturePolicy` on full success.
|
|
39
|
+
*/
|
|
40
|
+
export declare function readArchitecturePolicy(projectRoot: string): Promise<ArchitecturePolicy | undefined>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readFile as u}from"node:fs/promises";import{join as d}from"node:path";const p=".neocortex/architecture-policy.json",f=Object.freeze(["interactive","yoloop_friendly","fully_automated"]),y=Object.freeze(["aws","gcp","oci","azure","any"]),_=Object.freeze(["REST","GraphQL","tRPC"]),g=Object.freeze(["sync","async","hybrid"]),m=Object.freeze(["mobile-first","desktop-first","responsive"]),O=Object.freeze(["conservative","balanced","aggressive"]),b=Object.freeze(["TDD","test-after","BDD"]),h=new Set(["primary_persona","cloud_provider","api_style","integration_style","ui_priority","refactor_aggressiveness","test_workflow"]);function v(n){const r=[],o=[];if(typeof n!="object"||n===null||Array.isArray(n))return{valid:!1,errors:Object.freeze(["Policy must be a plain object"]),warnings:Object.freeze([])};const t=n;if(t.schema_version!==1&&r.push(`schema_version must be 1, got ${JSON.stringify(t.schema_version)}`),(typeof t.mode!="string"||!f.includes(t.mode))&&r.push(`mode must be one of [${f.join(", ")}], got ${JSON.stringify(t.mode)}`),t.defaults!==void 0&&t.defaults!==null)if(typeof t.defaults!="object"||Array.isArray(t.defaults))r.push("defaults must be an object");else{const e=t.defaults;for(const c of Object.keys(e))h.has(c)||o.push(`defaults.${c}: unknown field (ignored)`);e.primary_persona!==void 0&&e.primary_persona!==null&&typeof e.primary_persona!="string"&&r.push("defaults.primary_persona must be string or null"),i(e,"cloud_provider",y,r),i(e,"api_style",_,r),i(e,"integration_style",g,r),i(e,"ui_priority",m,r),i(e,"refactor_aggressiveness",O,r),i(e,"test_workflow",b,r)}return t.preserved_interactions!==void 0&&t.preserved_interactions!==null&&(!Array.isArray(t.preserved_interactions)||!t.preserved_interactions.every(e=>typeof e=="string"))&&r.push("preserved_interactions must be array of strings"),{valid:r.length===0,errors:Object.freeze(r),warnings:Object.freeze(o)}}async function A(n){const r=d(n,p);let o;try{o=await u(r,"utf8")}catch(s){if(s.code==="ENOENT")return;const l=s.message??String(s);console.warn(`[Neocortex] architecture-policy read failed (${r}): ${l}`);return}const t=o.replace(/^/,"").replace(/\r\n/g,`
|
|
2
|
+
`);let e;try{e=JSON.parse(t)}catch(s){const a=s.message??String(s);console.warn(`[Neocortex] architecture-policy malformed JSON (${r}): ${a}. Proceeding without policy.`);return}const c=v(e);if(!c.valid){console.warn(`[Neocortex] architecture-policy schema invalid (${r}): ${c.errors.join("; ")}. Proceeding without policy.`);return}return e}function i(n,r,o,t){const e=n[r];e!=null&&(typeof e!="string"||!o.includes(e))&&t.push(`defaults.${r} must be one of [${o.join(", ")}] or null, got ${JSON.stringify(e)}`)}export{p as POLICY_FILE_PATH,A as readArchitecturePolicy,v as validatePolicy};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* Barrel export for Epic P107.02 policy reader module.
|
|
6
|
+
*/
|
|
7
|
+
export { readArchitecturePolicy, validatePolicy, POLICY_FILE_PATH, } from './architecture-policy.js';
|
|
8
|
+
export type { ArchitecturePolicy, ArchitectureDefaults, ArchitecturePolicyValidationResult, PolicyMode, } from './shared-policy-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readArchitecturePolicy as c,validatePolicy as i,POLICY_FILE_PATH as o}from"./architecture-policy.js";export{o as POLICY_FILE_PATH,c as readArchitecturePolicy,i as validatePolicy};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P119.02: Inlined byte-identical types from
|
|
3
|
+
* `@neocortex/shared/types/architecture-policy`.
|
|
4
|
+
*
|
|
5
|
+
* SSoT-Shadow pattern (P92.01 server precedent extended by P117.01 to client
|
|
6
|
+
* checkpoint dist + P117.07 to client yoloop dist). Client tarball is published
|
|
7
|
+
* standalone via `@ornexus/neocortex` and does NOT include `@neocortex/shared`
|
|
8
|
+
* as a runtime dependency (workspace package, excluded from tarball per
|
|
9
|
+
* `.npmignore` + `tsconfig.build.json`). Any non-erased import of
|
|
10
|
+
* `@neocortex/shared` in `packages/client/dist/**` causes runtime
|
|
11
|
+
* `ERR_MODULE_NOT_FOUND` on globally installed `@ornexus/neocortex`.
|
|
12
|
+
*
|
|
13
|
+
* Pre-P119.02, three files leaked `import type` statements from
|
|
14
|
+
* `@neocortex/shared` in the published v4.19.1 tarball:
|
|
15
|
+
* - dist/policy/architecture-policy.d.ts
|
|
16
|
+
* - dist/policy/index.d.ts
|
|
17
|
+
* - dist/commands/invoke.d.ts (imported `YoloopPersistedState`)
|
|
18
|
+
*
|
|
19
|
+
* Type-only `import type` is erased at runtime (no module resolution attempt),
|
|
20
|
+
* but produces TS2307 in consumer projects that try to use the types via
|
|
21
|
+
* globally-installed CLI (`npm install -g @ornexus/neocortex`).
|
|
22
|
+
*
|
|
23
|
+
* Sync responsibility: `policy-shared-sync.test.ts` (client-side drift test,
|
|
24
|
+
* mirror of `checkpoint-shared-sync.test.ts` P117.01). Drift test fails CI
|
|
25
|
+
* if these diverge from SSoT canonical at
|
|
26
|
+
* `packages/shared/src/types/architecture-policy.ts`.
|
|
27
|
+
*
|
|
28
|
+
* Defense-in-depth: `validate-pre-publish.js` ships
|
|
29
|
+
* `validateClientNoSharedImport()` (P117.01) scanning client dist for
|
|
30
|
+
* `@neocortex/shared` runtime references. P119.02 expands its scope to also
|
|
31
|
+
* walk `dist/policy/` and `dist/commands/` (in addition to checkpoint + yoloop
|
|
32
|
+
* coverage from P117).
|
|
33
|
+
*
|
|
34
|
+
* DO NOT EDIT WITHOUT also editing
|
|
35
|
+
* `packages/shared/src/types/architecture-policy.ts`.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Policy mode controls how server-side injector treats consumer defaults.
|
|
39
|
+
*
|
|
40
|
+
* - `interactive`: Ask user on every decision (pre-P107 behavior, backward compat).
|
|
41
|
+
* - `yoloop_friendly`: Apply `defaults.*` when set + log audit entry (P107.05).
|
|
42
|
+
* - `fully_automated`: Apply `defaults.*` silently; still preserves `preserved_interactions`.
|
|
43
|
+
*/
|
|
44
|
+
export type PolicyMode = 'interactive' | 'yoloop_friendly' | 'fully_automated';
|
|
45
|
+
/**
|
|
46
|
+
* Optional default values that drive step prompt behavior.
|
|
47
|
+
* All fields are optional -- unset fields fall back to interactive questions.
|
|
48
|
+
* Each field maps to a specific stepId via `POLICY_FIELD_BY_STEP` (server-side).
|
|
49
|
+
*/
|
|
50
|
+
export interface ArchitectureDefaults {
|
|
51
|
+
/** For step-a-01 PRD generation. Free-form string (e.g. "B2B SaaS buyer"). */
|
|
52
|
+
readonly primary_persona?: string;
|
|
53
|
+
/** For step-a-02 architecture choices. */
|
|
54
|
+
readonly cloud_provider?: 'aws' | 'gcp' | 'oci' | 'azure' | 'any';
|
|
55
|
+
/** For step-a-03 api-contracts. */
|
|
56
|
+
readonly api_style?: 'REST' | 'GraphQL' | 'tRPC';
|
|
57
|
+
/** For step-a-04 api-integrations. */
|
|
58
|
+
readonly integration_style?: 'sync' | 'async' | 'hybrid';
|
|
59
|
+
/** For step-a-08 ux-design. */
|
|
60
|
+
readonly ui_priority?: 'mobile-first' | 'desktop-first' | 'responsive';
|
|
61
|
+
/** For step-r-03 refactor-plan. */
|
|
62
|
+
readonly refactor_aggressiveness?: 'conservative' | 'balanced' | 'aggressive';
|
|
63
|
+
/** For step-c-04 write-spec. */
|
|
64
|
+
readonly test_workflow?: 'TDD' | 'test-after' | 'BDD';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Top-level policy shape persisted in `.neocortex/architecture-policy.json`.
|
|
68
|
+
* Consumer copies `architecture-policy.template.json` from repo root and edits.
|
|
69
|
+
*/
|
|
70
|
+
export interface ArchitecturePolicy {
|
|
71
|
+
/** Wire-format version. Must be literal 1 in v1. */
|
|
72
|
+
readonly schema_version: 1;
|
|
73
|
+
readonly mode: PolicyMode;
|
|
74
|
+
readonly defaults?: ArchitectureDefaults;
|
|
75
|
+
/**
|
|
76
|
+
* stepIds that ALWAYS require human interaction, regardless of mode.
|
|
77
|
+
* Defaults to `ARCHITECTURE_POLICY_DEFAULT_PRESERVED` if absent.
|
|
78
|
+
*/
|
|
79
|
+
readonly preserved_interactions?: readonly string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Output of `validateArchitecturePolicy()` (server-side P107.03 exports validator).
|
|
83
|
+
* Fail-soft shape: validation errors NEVER throw; caller decides action.
|
|
84
|
+
*/
|
|
85
|
+
export interface ArchitecturePolicyValidationResult {
|
|
86
|
+
readonly valid: boolean;
|
|
87
|
+
readonly errors: readonly string[];
|
|
88
|
+
readonly warnings: readonly string[];
|
|
89
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Neocortex CLI, licensed under the
|
|
6
|
+
* Functional Source License, Version 1.1 (FSL-1.1).
|
|
7
|
+
*
|
|
8
|
+
* Change Date: February 20, 2029
|
|
9
|
+
* Change License: MIT
|
|
10
|
+
*
|
|
11
|
+
* See the LICENSE file in the project root for full license text.
|
|
12
|
+
*/
|
|
13
|
+
export type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';
|
|
14
|
+
export interface CircuitBreakerConfig {
|
|
15
|
+
/** Number of failures within window to trip circuit. Default: 3 */
|
|
16
|
+
failureThreshold: number;
|
|
17
|
+
/** Window in ms for counting failures. Default: 60_000 (60s) */
|
|
18
|
+
failureWindowMs: number;
|
|
19
|
+
/** Time in ms before OPEN transitions to HALF_OPEN. Default: 60_000 (60s) */
|
|
20
|
+
halfOpenAfterMs: number;
|
|
21
|
+
/** Path to persist circuit state. Default: ~/.neocortex/.circuit-state */
|
|
22
|
+
stateFilePath: string;
|
|
23
|
+
}
|
|
24
|
+
export interface FailureRecord {
|
|
25
|
+
timestamp: number;
|
|
26
|
+
}
|
|
27
|
+
export interface CircuitBreakerState {
|
|
28
|
+
state: CircuitState;
|
|
29
|
+
failures: FailureRecord[];
|
|
30
|
+
openedAt: number | null;
|
|
31
|
+
lastProbeAt: number | null;
|
|
32
|
+
}
|
|
33
|
+
export declare class ClientCircuitBreaker {
|
|
34
|
+
private readonly config;
|
|
35
|
+
private internalState;
|
|
36
|
+
constructor(config?: Partial<CircuitBreakerConfig>, initialState?: CircuitBreakerState);
|
|
37
|
+
/**
|
|
38
|
+
* Check if a request can be made to the server.
|
|
39
|
+
* Returns false if circuit is OPEN (fail-fast to cache).
|
|
40
|
+
*/
|
|
41
|
+
canCall(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Record a successful server response. Closes the circuit.
|
|
44
|
+
*/
|
|
45
|
+
recordSuccess(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Record a failed server response. Opens circuit after threshold failures in window.
|
|
48
|
+
*/
|
|
49
|
+
recordFailure(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Get current circuit breaker state (copy).
|
|
52
|
+
*/
|
|
53
|
+
getState(): CircuitBreakerState;
|
|
54
|
+
/**
|
|
55
|
+
* Reset circuit breaker to initial CLOSED state.
|
|
56
|
+
*/
|
|
57
|
+
reset(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Load circuit breaker state from disk.
|
|
60
|
+
*/
|
|
61
|
+
static loadFromDisk(path?: string): Promise<ClientCircuitBreaker>;
|
|
62
|
+
/**
|
|
63
|
+
* Remove failures outside the counting window.
|
|
64
|
+
*/
|
|
65
|
+
private pruneExpiredFailures;
|
|
66
|
+
/**
|
|
67
|
+
* Persist state to disk with atomic write.
|
|
68
|
+
*/
|
|
69
|
+
private saveToDisk;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFile as l,writeFile as o,mkdir as h}from"node:fs/promises";import{dirname as u}from"node:path";import{homedir as c}from"node:os";import{join as f}from"node:path";const n={failureThreshold:3,failureWindowMs:6e4,halfOpenAfterMs:6e4,stateFilePath:f(c(),".neocortex",".circuit-state")},r={state:"CLOSED",failures:[],openedAt:null,lastProbeAt:null};class i{config;internalState;constructor(t,e){this.config={...n,...t},this.internalState=e?{...e}:{...r,failures:[]}}canCall(){switch(this.pruneExpiredFailures(),this.internalState.state){case"CLOSED":return!0;case"OPEN":{const t=Date.now(),e=this.internalState.openedAt??0;return t-e>=this.config.halfOpenAfterMs?(this.internalState.state="HALF_OPEN",this.internalState.lastProbeAt=t,!0):!1}case"HALF_OPEN":return!0;default:return!0}}async recordSuccess(){this.internalState.state="CLOSED",this.internalState.failures=[],this.internalState.openedAt=null,this.internalState.lastProbeAt=null,await this.saveToDisk()}async recordFailure(){const t=Date.now();this.internalState.failures.push({timestamp:t}),this.pruneExpiredFailures(),this.internalState.failures.length>=this.config.failureThreshold&&(this.internalState.state="OPEN",this.internalState.openedAt=t),this.internalState.state==="HALF_OPEN"&&(this.internalState.state="OPEN",this.internalState.openedAt=t),await this.saveToDisk()}getState(){return this.pruneExpiredFailures(),{state:this.internalState.state,failures:[...this.internalState.failures],openedAt:this.internalState.openedAt,lastProbeAt:this.internalState.lastProbeAt}}async reset(){this.internalState={...r,failures:[]},await this.saveToDisk()}static async loadFromDisk(t){const e=t??n.stateFilePath;try{const s=await l(e,"utf8"),a=JSON.parse(s);return!a.state||!Array.isArray(a.failures)?new i({stateFilePath:e}):new i({stateFilePath:e},a)}catch{return new i({stateFilePath:e})}}pruneExpiredFailures(){const t=Date.now()-this.config.failureWindowMs;this.internalState.failures=this.internalState.failures.filter(e=>e.timestamp>t)}async saveToDisk(){try{const t=u(this.config.stateFilePath);await h(t,{recursive:!0});const e=`${this.config.stateFilePath}.tmp`,s=JSON.stringify(this.internalState,null,2);await o(e,s,"utf8");const{rename:a}=await import("node:fs/promises");await a(e,this.config.stateFilePath)}catch{}}}export{i as ClientCircuitBreaker};
|