@ornexus/neocortex 4.0.1 → 4.0.2
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/install.ps1 +92 -33
- package/install.sh +15 -1
- package/package.json +3 -3
- package/packages/client/dist/adapters/adapter-registry.js +1 -106
- package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
- package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
- package/packages/client/dist/adapters/codex-adapter.js +2 -80
- package/packages/client/dist/adapters/cursor-adapter.js +4 -115
- package/packages/client/dist/adapters/gemini-adapter.js +2 -71
- package/packages/client/dist/adapters/index.js +1 -21
- package/packages/client/dist/adapters/platform-detector.js +1 -106
- package/packages/client/dist/adapters/target-adapter.js +0 -12
- package/packages/client/dist/adapters/vscode-adapter.js +2 -72
- package/packages/client/dist/agent/refresh-stubs.js +2 -234
- package/packages/client/dist/agent/update-agent-yaml.js +1 -102
- package/packages/client/dist/agent/update-description.js +1 -251
- package/packages/client/dist/cache/crypto-utils.js +1 -76
- package/packages/client/dist/cache/encrypted-cache.js +1 -94
- package/packages/client/dist/cache/in-memory-asset-cache.js +1 -70
- package/packages/client/dist/cache/index.js +1 -13
- package/packages/client/dist/cli.js +2 -163
- package/packages/client/dist/commands/activate.js +8 -390
- package/packages/client/dist/commands/cache-status.js +2 -112
- package/packages/client/dist/commands/invoke.js +28 -490
- package/packages/client/dist/config/resolver-selection.js +1 -278
- package/packages/client/dist/config/secure-config.js +12 -269
- package/packages/client/dist/constants.js +1 -25
- package/packages/client/dist/context/context-collector.js +2 -222
- package/packages/client/dist/context/context-sanitizer.js +1 -145
- package/packages/client/dist/index.js +1 -38
- package/packages/client/dist/license/index.js +1 -5
- package/packages/client/dist/license/license-client.js +1 -257
- package/packages/client/dist/machine/fingerprint.js +2 -160
- package/packages/client/dist/machine/index.js +1 -5
- package/packages/client/dist/resilience/circuit-breaker.js +1 -170
- package/packages/client/dist/resilience/degradation-manager.js +1 -164
- package/packages/client/dist/resilience/freshness-indicator.js +1 -100
- package/packages/client/dist/resilience/index.js +1 -8
- package/packages/client/dist/resilience/recovery-detector.js +1 -74
- package/packages/client/dist/resolvers/asset-resolver.js +0 -13
- package/packages/client/dist/resolvers/local-resolver.js +8 -218
- package/packages/client/dist/resolvers/remote-resolver.js +1 -282
- package/packages/client/dist/telemetry/index.js +1 -5
- package/packages/client/dist/telemetry/offline-queue.js +1 -131
- package/packages/client/dist/tier/index.js +1 -5
- package/packages/client/dist/tier/tier-aware-client.js +1 -260
- package/packages/client/dist/types/index.js +1 -38
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/install-antigravity.sh +49 -3
- package/targets-stubs/antigravity/skill/SKILL.md +23 -4
- package/targets-stubs/claude-code/neocortex.agent.yaml +19 -1
- package/targets-stubs/claude-code/neocortex.md +64 -29
- package/targets-stubs/codex/agents.md +20 -3
- package/targets-stubs/codex/config-mcp.toml +5 -0
- package/targets-stubs/cursor/agent.md +23 -5
- package/targets-stubs/cursor/install-cursor.sh +51 -3
- package/targets-stubs/cursor/mcp.json +7 -0
- package/targets-stubs/gemini-cli/agent.md +37 -6
- package/targets-stubs/gemini-cli/install-gemini.sh +50 -17
- package/targets-stubs/vscode/agent.md +47 -10
- package/targets-stubs/vscode/install-vscode.sh +50 -3
- package/targets-stubs/vscode/mcp.json +8 -0
|
@@ -1,260 +1 @@
|
|
|
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
|
-
// ── Constants ────────────────────────────────────────────────────────────
|
|
14
|
-
const TIER_CACHE_KEY = 'neocortex:tier';
|
|
15
|
-
const QUOTA_CACHE_KEY_PREFIX = 'neocortex:quota:';
|
|
16
|
-
const QUOTA_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
17
|
-
const TIER_CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour (Story 31.05: reduced from 24h to align with short-lived JWTs)
|
|
18
|
-
const VALID_TIERS = new Set(['free', 'pro', 'enterprise']);
|
|
19
|
-
const DEFAULT_TIER = 'free';
|
|
20
|
-
// ── Trigger Gates (inlined from shared tier-config to avoid import issues) ─
|
|
21
|
-
const TRIGGER_GATES = {
|
|
22
|
-
'status': 'free',
|
|
23
|
-
'init': 'free',
|
|
24
|
-
'create-epic': 'free',
|
|
25
|
-
'idea-diagnose': 'free',
|
|
26
|
-
'idea-research': 'free',
|
|
27
|
-
'generate-epic': 'free',
|
|
28
|
-
'exec': 'pro',
|
|
29
|
-
'yolo': 'pro',
|
|
30
|
-
'epic': 'pro',
|
|
31
|
-
'setup-branch': 'free',
|
|
32
|
-
'diagnose': 'free',
|
|
33
|
-
'research': 'free',
|
|
34
|
-
'write-spec': 'free',
|
|
35
|
-
'create-tasks': 'free',
|
|
36
|
-
'implement': 'free',
|
|
37
|
-
'update-memory': 'free',
|
|
38
|
-
'commit': 'free',
|
|
39
|
-
'sync': 'free',
|
|
40
|
-
'create-pr': 'free',
|
|
41
|
-
'review': 'pro',
|
|
42
|
-
'merge': 'free',
|
|
43
|
-
'fix-blocked': 'free',
|
|
44
|
-
'finalize-epic': 'free',
|
|
45
|
-
'cleanup': 'free',
|
|
46
|
-
'resolve-conflicts': 'free',
|
|
47
|
-
'audit': 'free',
|
|
48
|
-
'menu': 'free',
|
|
49
|
-
'plans': 'free',
|
|
50
|
-
'billing': 'free',
|
|
51
|
-
'subscribe': 'free',
|
|
52
|
-
};
|
|
53
|
-
const TIER_HIERARCHY = {
|
|
54
|
-
free: 0,
|
|
55
|
-
pro: 1,
|
|
56
|
-
enterprise: 2,
|
|
57
|
-
};
|
|
58
|
-
// ── TierAwareClient ──────────────────────────────────────────────────────
|
|
59
|
-
export class TierAwareClient {
|
|
60
|
-
cache;
|
|
61
|
-
licenseClient;
|
|
62
|
-
cachedTier = null;
|
|
63
|
-
constructor(options) {
|
|
64
|
-
this.cache = options.cacheProvider;
|
|
65
|
-
this.licenseClient = options.licenseClient;
|
|
66
|
-
}
|
|
67
|
-
// ── Story 60.1: Tier Extraction from JWT + Cache ────────────────────
|
|
68
|
-
/**
|
|
69
|
-
* Get the current tier. Checks in-memory, then cache, then JWT token.
|
|
70
|
-
* NEVER throws - returns 'free' on failure (fail-open).
|
|
71
|
-
*/
|
|
72
|
-
async getCachedTier() {
|
|
73
|
-
try {
|
|
74
|
-
// 1. In-memory
|
|
75
|
-
if (this.cachedTier)
|
|
76
|
-
return this.cachedTier;
|
|
77
|
-
// 2. EncryptedCache
|
|
78
|
-
const cached = await this.cache.get(TIER_CACHE_KEY);
|
|
79
|
-
if (cached && VALID_TIERS.has(cached)) {
|
|
80
|
-
this.cachedTier = cached;
|
|
81
|
-
return this.cachedTier;
|
|
82
|
-
}
|
|
83
|
-
// 3. Extract from JWT
|
|
84
|
-
const token = await this.licenseClient.getToken();
|
|
85
|
-
if (token) {
|
|
86
|
-
const tier = this.extractTierFromJwt(token);
|
|
87
|
-
this.cachedTier = tier;
|
|
88
|
-
// Persist to cache (fire-and-forget)
|
|
89
|
-
this.cache.set(TIER_CACHE_KEY, tier, TIER_CACHE_TTL_MS).catch(() => { });
|
|
90
|
-
return tier;
|
|
91
|
-
}
|
|
92
|
-
return DEFAULT_TIER;
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
return DEFAULT_TIER;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Update cached tier (called when server returns tier info).
|
|
100
|
-
*/
|
|
101
|
-
async updateTier(tier) {
|
|
102
|
-
try {
|
|
103
|
-
if (!VALID_TIERS.has(tier))
|
|
104
|
-
return;
|
|
105
|
-
this.cachedTier = tier;
|
|
106
|
-
await this.cache.set(TIER_CACHE_KEY, tier, TIER_CACHE_TTL_MS).catch(() => { });
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
// Non-critical
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// ── Story 18.8: Tier Cache Invalidation ──────────────────────────────
|
|
113
|
-
/**
|
|
114
|
-
* Invalidate all tier and quota caches.
|
|
115
|
-
* Called when a tier change is detected to ensure fresh data.
|
|
116
|
-
* NEVER throws.
|
|
117
|
-
*/
|
|
118
|
-
async invalidateTierCache() {
|
|
119
|
-
try {
|
|
120
|
-
this.cachedTier = null;
|
|
121
|
-
await this.cache.clear().catch(() => { });
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
// Non-critical
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
// ── Story 60.2: Pre-flight Trigger Check ────────────────────────────
|
|
128
|
-
/**
|
|
129
|
-
* Check if a trigger is allowed for the current tier WITHOUT calling the server.
|
|
130
|
-
* Returns immediately (in-memory lookup).
|
|
131
|
-
* NEVER throws - returns { allowed: true } on failure (fail-open).
|
|
132
|
-
*/
|
|
133
|
-
async preFlightCheck(trigger, tier) {
|
|
134
|
-
try {
|
|
135
|
-
const userTier = tier ?? await this.getCachedTier();
|
|
136
|
-
const requiredTier = TRIGGER_GATES[trigger] ?? 'free';
|
|
137
|
-
if (TIER_HIERARCHY[userTier] >= TIER_HIERARCHY[requiredTier]) {
|
|
138
|
-
return { allowed: true };
|
|
139
|
-
}
|
|
140
|
-
const message = this.buildUpgradeMessage(trigger, userTier, requiredTier);
|
|
141
|
-
return { allowed: false, message };
|
|
142
|
-
}
|
|
143
|
-
catch {
|
|
144
|
-
// Fail-open: allow on error
|
|
145
|
-
return { allowed: true };
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// ── Story 60.3: Quota Cache from Response ───────────────────────────
|
|
149
|
-
/**
|
|
150
|
-
* Update cached quota from server response metadata.
|
|
151
|
-
* Called after each successful invoke.
|
|
152
|
-
*/
|
|
153
|
-
async updateQuotaFromResponse(metadata) {
|
|
154
|
-
try {
|
|
155
|
-
const quotaRemaining = metadata.quotaRemaining;
|
|
156
|
-
if (!quotaRemaining)
|
|
157
|
-
return;
|
|
158
|
-
const snapshot = {
|
|
159
|
-
stepsRemaining: quotaRemaining.stepsRemaining ?? 0,
|
|
160
|
-
invocationsRemaining: quotaRemaining.invocationsRemaining ?? 0,
|
|
161
|
-
stepsLimit: quotaRemaining.stepsLimit ?? 0,
|
|
162
|
-
invocationsLimit: quotaRemaining.invocationsLimit ?? 0,
|
|
163
|
-
cachedAt: Date.now(),
|
|
164
|
-
};
|
|
165
|
-
const dateKey = this.getQuotaCacheKey();
|
|
166
|
-
await this.cache.set(dateKey, JSON.stringify(snapshot), QUOTA_TTL_MS).catch(() => { });
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
// Non-critical
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Get cached quota for today.
|
|
174
|
-
* NEVER throws - returns null if cache empty or expired.
|
|
175
|
-
*/
|
|
176
|
-
async getCachedQuota() {
|
|
177
|
-
try {
|
|
178
|
-
const dateKey = this.getQuotaCacheKey();
|
|
179
|
-
const raw = await this.cache.get(dateKey);
|
|
180
|
-
if (!raw)
|
|
181
|
-
return null;
|
|
182
|
-
const snapshot = JSON.parse(raw);
|
|
183
|
-
// Validate TTL (EncryptedCache already handles this, but double-check)
|
|
184
|
-
if (Date.now() - snapshot.cachedAt > QUOTA_TTL_MS)
|
|
185
|
-
return null;
|
|
186
|
-
return snapshot;
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// ── Story 60.4: Offline Enforcement ─────────────────────────────────
|
|
193
|
-
/**
|
|
194
|
-
* Check quota in offline mode using cached data.
|
|
195
|
-
* NEVER throws - returns { allowed: true } on failure (fail-open).
|
|
196
|
-
*
|
|
197
|
-
* @param isOffline - Whether the circuit breaker is in L2+ degradation
|
|
198
|
-
*/
|
|
199
|
-
async offlineQuotaCheck(isOffline = false) {
|
|
200
|
-
try {
|
|
201
|
-
if (!isOffline)
|
|
202
|
-
return { allowed: true };
|
|
203
|
-
const quota = await this.getCachedQuota();
|
|
204
|
-
// Fail-open: if no cached quota, allow
|
|
205
|
-
if (!quota)
|
|
206
|
-
return { allowed: true };
|
|
207
|
-
// Check steps
|
|
208
|
-
if (quota.stepsRemaining <= 0 && quota.stepsLimit > 0) {
|
|
209
|
-
return {
|
|
210
|
-
allowed: false,
|
|
211
|
-
message: `Daily step limit reached (${quota.stepsLimit}/${quota.stepsLimit}). Resets at 00:00 UTC.`,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
// Check invocations
|
|
215
|
-
if (quota.invocationsRemaining <= 0 && quota.invocationsLimit > 0) {
|
|
216
|
-
return {
|
|
217
|
-
allowed: false,
|
|
218
|
-
message: `Daily invocation limit reached (${quota.invocationsLimit}/${quota.invocationsLimit}). Resets at 00:00 UTC.`,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
return { allowed: true };
|
|
222
|
-
}
|
|
223
|
-
catch {
|
|
224
|
-
// Fail-open
|
|
225
|
-
return { allowed: true };
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
// ── Private Helpers ─────────────────────────────────────────────────
|
|
229
|
-
/**
|
|
230
|
-
* Extract tier from JWT payload via base64url decode.
|
|
231
|
-
* No cryptographic verification - client-side is UX only.
|
|
232
|
-
*/
|
|
233
|
-
extractTierFromJwt(token) {
|
|
234
|
-
try {
|
|
235
|
-
const parts = token.split('.');
|
|
236
|
-
if (parts.length !== 3)
|
|
237
|
-
return DEFAULT_TIER;
|
|
238
|
-
// Decode base64url payload
|
|
239
|
-
const payload = parts[1];
|
|
240
|
-
const decoded = Buffer.from(payload, 'base64url').toString('utf8');
|
|
241
|
-
const claims = JSON.parse(decoded);
|
|
242
|
-
const tier = claims.tier;
|
|
243
|
-
if (tier && VALID_TIERS.has(tier)) {
|
|
244
|
-
return tier;
|
|
245
|
-
}
|
|
246
|
-
return DEFAULT_TIER;
|
|
247
|
-
}
|
|
248
|
-
catch {
|
|
249
|
-
return DEFAULT_TIER;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
buildUpgradeMessage(trigger, currentTier, requiredTier) {
|
|
253
|
-
return `The *${trigger} command requires ${requiredTier.toUpperCase()} plan. Your current plan: ${currentTier.toUpperCase()}. Upgrade: neocortex.dev/pricing`;
|
|
254
|
-
}
|
|
255
|
-
getQuotaCacheKey() {
|
|
256
|
-
const now = new Date();
|
|
257
|
-
const dateStr = now.toISOString().slice(0, 10); // YYYY-MM-DD UTC
|
|
258
|
-
return `${QUOTA_CACHE_KEY_PREFIX}${dateStr}`;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
1
|
+
const s="neocortex:tier",l="neocortex:quota:",d=3e5,p=36e5,n=new Set(["free","pro","enterprise"]),a="free",u={status:"free",init:"free","create-epic":"free","idea-diagnose":"free","idea-research":"free","generate-epic":"free",exec:"pro",yolo:"pro",epic:"pro","setup-branch":"free",diagnose:"free",research:"free","write-spec":"free","create-tasks":"free",implement:"free","update-memory":"free",commit:"free",sync:"free","create-pr":"free",review:"pro",merge:"free","fix-blocked":"free","finalize-epic":"free",cleanup:"free","resolve-conflicts":"free",audit:"free",menu:"free",plans:"free",billing:"free",subscribe:"free"},o={free:0,pro:1,enterprise:2};class T{cache;licenseClient;cachedTier=null;constructor(t){this.cache=t.cacheProvider,this.licenseClient=t.licenseClient}async getCachedTier(){try{if(this.cachedTier)return this.cachedTier;const t=await this.cache.get(s);if(t&&n.has(t))return this.cachedTier=t,this.cachedTier;const e=await this.licenseClient.getToken();if(e){const r=this.extractTierFromJwt(e);return this.cachedTier=r,this.cache.set(s,r,36e5).catch(()=>{}),r}return a}catch{return a}}async updateTier(t){try{if(!n.has(t))return;this.cachedTier=t,await this.cache.set(s,t,36e5).catch(()=>{})}catch{}}async invalidateTierCache(){try{this.cachedTier=null,await this.cache.clear().catch(()=>{})}catch{}}async preFlightCheck(t,e){try{const r=e??await this.getCachedTier(),i=u[t]??"free";return o[r]>=o[i]?{allowed:!0}:{allowed:!1,message:this.buildUpgradeMessage(t,r,i)}}catch{return{allowed:!0}}}async updateQuotaFromResponse(t){try{const e=t.quotaRemaining;if(!e)return;const r={stepsRemaining:e.stepsRemaining??0,invocationsRemaining:e.invocationsRemaining??0,stepsLimit:e.stepsLimit??0,invocationsLimit:e.invocationsLimit??0,cachedAt:Date.now()},i=this.getQuotaCacheKey();await this.cache.set(i,JSON.stringify(r),3e5).catch(()=>{})}catch{}}async getCachedQuota(){try{const t=this.getQuotaCacheKey(),e=await this.cache.get(t);if(!e)return null;const r=JSON.parse(e);return Date.now()-r.cachedAt>3e5?null:r}catch{return null}}async offlineQuotaCheck(t=!1){try{if(!t)return{allowed:!0};const e=await this.getCachedQuota();return e?e.stepsRemaining<=0&&e.stepsLimit>0?{allowed:!1,message:`Daily step limit reached (${e.stepsLimit}/${e.stepsLimit}). Resets at 00:00 UTC.`}:e.invocationsRemaining<=0&&e.invocationsLimit>0?{allowed:!1,message:`Daily invocation limit reached (${e.invocationsLimit}/${e.invocationsLimit}). Resets at 00:00 UTC.`}:{allowed:!0}:{allowed:!0}}catch{return{allowed:!0}}}extractTierFromJwt(t){try{const e=t.split(".");if(e.length!==3)return a;const r=e[1],i=Buffer.from(r,"base64url").toString("utf8"),c=JSON.parse(i).tier;return c&&n.has(c)?c:a}catch{return a}}buildUpgradeMessage(t,e,r){return`The *${t} command requires ${r.toUpperCase()} plan. Your current plan: ${e.toUpperCase()}. Upgrade: neocortex.dev/pricing`}getQuotaCacheKey(){const e=new Date().toISOString().slice(0,10);return`${l}${e}`}}export{T as TierAwareClient};
|
|
@@ -1,38 +1 @@
|
|
|
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
|
-
/**
|
|
14
|
-
* @neocortex/client - Type Definitions
|
|
15
|
-
*
|
|
16
|
-
* All types for the asset resolution abstraction layer.
|
|
17
|
-
*/
|
|
18
|
-
// ── Resolver Mode ────────────────────────────────────────────────────────
|
|
19
|
-
/** Mode of asset resolution */
|
|
20
|
-
export var ResolverMode;
|
|
21
|
-
(function (ResolverMode) {
|
|
22
|
-
/** Read assets from local filesystem (development) */
|
|
23
|
-
ResolverMode["LOCAL"] = "local";
|
|
24
|
-
/** Fetch assets from remote IP Protection Server (production) */
|
|
25
|
-
ResolverMode["REMOTE"] = "remote";
|
|
26
|
-
})(ResolverMode || (ResolverMode = {}));
|
|
27
|
-
/** No-op cache implementation for development/fallback */
|
|
28
|
-
export class NoOpCache {
|
|
29
|
-
async get() {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
async set() {
|
|
33
|
-
// No-op: cache disabled
|
|
34
|
-
}
|
|
35
|
-
async clear() {
|
|
36
|
-
// No-op: nothing to clear
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
var a;(function(e){e.LOCAL="local",e.REMOTE="remote"})(a||(a={}));class c{async get(){return null}async set(){}async clear(){}}export{c as NoOpCache,a as ResolverMode};
|
|
@@ -2,6 +2,53 @@
|
|
|
2
2
|
# Neocortex - Google Antigravity Install Adapter (Thin Client)
|
|
3
3
|
# Simplified installer for npm tarball mode (targets-stubs only)
|
|
4
4
|
|
|
5
|
+
# Additive JSON merge for Antigravity MCP config (flat JSON, keys are server names).
|
|
6
|
+
# Preserves user-defined servers. Never overwrites silently.
|
|
7
|
+
_merge_antigravity_mcp() {
|
|
8
|
+
local stub_file="$1"
|
|
9
|
+
local dest_file="$2"
|
|
10
|
+
|
|
11
|
+
if [ ! -f "$dest_file" ]; then
|
|
12
|
+
cp "$stub_file" "$dest_file"
|
|
13
|
+
echo "[ANTIGRAVITY] Created MCP config: $dest_file"
|
|
14
|
+
return 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
if command -v jq >/dev/null 2>&1; then
|
|
18
|
+
local tmp="${dest_file}.neocortex.tmp"
|
|
19
|
+
if jq -s '.[0] * .[1]' "$dest_file" "$stub_file" > "$tmp" 2>/dev/null; then
|
|
20
|
+
mv "$tmp" "$dest_file"
|
|
21
|
+
echo "[ANTIGRAVITY] Merged MCP config into: $dest_file (via jq)"
|
|
22
|
+
return 0
|
|
23
|
+
fi
|
|
24
|
+
rm -f "$tmp"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if command -v python3 >/dev/null 2>&1; then
|
|
28
|
+
if python3 - "$dest_file" "$stub_file" <<'PYEOF' 2>/dev/null
|
|
29
|
+
import json, sys
|
|
30
|
+
dest_path, stub_path = sys.argv[1], sys.argv[2]
|
|
31
|
+
with open(dest_path) as f:
|
|
32
|
+
dest = json.load(f)
|
|
33
|
+
with open(stub_path) as f:
|
|
34
|
+
stub = json.load(f)
|
|
35
|
+
for k, v in stub.items():
|
|
36
|
+
dest[k] = v
|
|
37
|
+
with open(dest_path, 'w') as f:
|
|
38
|
+
json.dump(dest, f, indent=2)
|
|
39
|
+
f.write('\n')
|
|
40
|
+
PYEOF
|
|
41
|
+
then
|
|
42
|
+
echo "[ANTIGRAVITY] Merged MCP config into: $dest_file (via python3)"
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
echo "[ANTIGRAVITY] WARN: jq and python3 not found; leaving existing $dest_file untouched"
|
|
48
|
+
echo "[ANTIGRAVITY] WARN: Stub available at: $stub_file"
|
|
49
|
+
return 0
|
|
50
|
+
}
|
|
51
|
+
|
|
5
52
|
install_antigravity() {
|
|
6
53
|
local source_dir="${1:?SOURCE_DIR required}"
|
|
7
54
|
local dest_dir="${2:?DEST_DIR required}"
|
|
@@ -26,10 +73,9 @@ install_antigravity() {
|
|
|
26
73
|
echo "[ANTIGRAVITY] Installed skill stub: .agent/skills/neocortex/SKILL.md"
|
|
27
74
|
fi
|
|
28
75
|
|
|
29
|
-
# 2.
|
|
76
|
+
# 2. Additive merge MCP config (preserves user-configured servers)
|
|
30
77
|
if [ -f "$ag_target/mcp-config.json" ]; then
|
|
31
|
-
|
|
32
|
-
echo "[ANTIGRAVITY] Installed MCP config: ~/.gemini/antigravity/mcp_config.json"
|
|
78
|
+
_merge_antigravity_mcp "$ag_target/mcp-config.json" "$gemini_home/antigravity/mcp_config.json" || true
|
|
33
79
|
fi
|
|
34
80
|
|
|
35
81
|
# 3. Copy GEMINI.md stub to project root
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: neocortex
|
|
3
|
-
description: "🧠 Neocortex v4.0.
|
|
3
|
+
description: "🧠 Neocortex v4.0.2 | OrNexus Team"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!-- CRITICAL: Plugin Conflict Prevention -->
|
|
@@ -61,7 +61,26 @@ neocortex-client invoke \
|
|
|
61
61
|
|
|
62
62
|
## Regras
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
- NUNCA
|
|
66
|
-
-
|
|
64
|
+
### Orquestracao (triggers `*xxx`)
|
|
65
|
+
- NUNCA invente logica de orquestracao - toda logica de pipeline/step/workflow vem do server
|
|
66
|
+
- NUNCA pule o thin client para argumentos prefixados com `*` - sempre execute `neocortex-client invoke`
|
|
67
|
+
- SEMPRE siga as instrucoes retornadas pelo server literalmente
|
|
67
68
|
- Se o thin client falhar, mostre o erro e aguarde input do usuario
|
|
69
|
+
|
|
70
|
+
### Pesquisa livre / analise (sem prefixo `*`)
|
|
71
|
+
Quando o usuario pedir pesquisa, analise, brainstorm, validacao de hipotese, ou qualquer
|
|
72
|
+
tarefa free-form que NAO seja um trigger de orquestracao, voce TEM permissao para usar
|
|
73
|
+
diretamente as tools do Antigravity:
|
|
74
|
+
|
|
75
|
+
- **File operations** (read / write / edit / glob / grep) - exploracao e manipulacao do projeto local
|
|
76
|
+
- **Shell / terminal** - qualquer ferramenta CLI (jq, curl, psql, docker, fly, gh, etc.)
|
|
77
|
+
- **Browser automation** (built-in via Antigravity's browser tools) - screenshots,
|
|
78
|
+
visual research, scraping
|
|
79
|
+
- **Web search / fetch** - pesquisa de mercado, validacao de hipoteses, references reais
|
|
80
|
+
- **MCP servers configurados** (context7, playwright) - documentacao atualizada de
|
|
81
|
+
libs/frameworks, automacao de navegador adicional. Ver `~/.gemini/antigravity/mcp_config.json`.
|
|
82
|
+
|
|
83
|
+
NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
|
|
84
|
+
dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
|
|
85
|
+
precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
|
|
86
|
+
para entrar no fluxo de orquestracao.
|
|
@@ -4,7 +4,7 @@ agent:
|
|
|
4
4
|
name: 'Neocortex'
|
|
5
5
|
title: 'Development Orchestrator'
|
|
6
6
|
icon: '>'
|
|
7
|
-
version: '4.0.
|
|
7
|
+
version: '4.0.2'
|
|
8
8
|
architecture: 'thin-client'
|
|
9
9
|
module: stand-alone
|
|
10
10
|
hasSidecar: false
|
|
@@ -18,7 +18,25 @@ agent:
|
|
|
18
18
|
- Read
|
|
19
19
|
- Write
|
|
20
20
|
- Edit
|
|
21
|
+
- NotebookEdit
|
|
21
22
|
- Glob
|
|
22
23
|
- Grep
|
|
24
|
+
- Task
|
|
25
|
+
- TaskCreate
|
|
26
|
+
- Skill
|
|
27
|
+
- WebSearch
|
|
28
|
+
- WebFetch
|
|
29
|
+
- mcp__context7__resolve-library-id
|
|
30
|
+
- mcp__context7__query-docs
|
|
31
|
+
- mcp__playwright__browser_navigate
|
|
32
|
+
- mcp__playwright__browser_snapshot
|
|
33
|
+
- mcp__playwright__browser_take_screenshot
|
|
34
|
+
- mcp__playwright__browser_click
|
|
35
|
+
- mcp__playwright__browser_type
|
|
36
|
+
- mcp__playwright__browser_evaluate
|
|
37
|
+
- mcp__playwright__browser_console_messages
|
|
38
|
+
- mcp__playwright__browser_network_requests
|
|
39
|
+
- mcp__playwright__browser_wait_for
|
|
40
|
+
- mcp__playwright__browser_close
|
|
23
41
|
|
|
24
42
|
instructions: neocortex.md
|
|
@@ -1,39 +1,55 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: neocortex
|
|
3
|
-
description: "🧠 Neocortex v4.0.
|
|
3
|
+
description: "🧠 Neocortex v4.0.2 | OrNexus Team"
|
|
4
4
|
model: opus
|
|
5
5
|
color: blue
|
|
6
6
|
tools:
|
|
7
|
+
# File operations
|
|
7
8
|
- Read
|
|
8
9
|
- Write
|
|
9
10
|
- Edit
|
|
11
|
+
- NotebookEdit
|
|
10
12
|
- Glob
|
|
11
13
|
- Grep
|
|
14
|
+
|
|
15
|
+
# Subagent delegation + planning + skills
|
|
12
16
|
- Task
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
17
|
+
- TaskCreate
|
|
18
|
+
- Skill
|
|
19
|
+
|
|
20
|
+
# Web research (essential for product/market/UX research that the server cannot resolve)
|
|
21
|
+
- WebSearch
|
|
22
|
+
- WebFetch
|
|
23
|
+
|
|
24
|
+
# Bash - full access (no allowlist) for maximum tool reach
|
|
25
|
+
- Bash
|
|
26
|
+
|
|
27
|
+
# MCP: context7 (current library/framework documentation)
|
|
28
|
+
- mcp__context7__resolve-library-id
|
|
29
|
+
- mcp__context7__query-docs
|
|
30
|
+
|
|
31
|
+
# MCP: playwright (browser automation for visual research, screenshots, scraping)
|
|
32
|
+
- mcp__playwright__browser_navigate
|
|
33
|
+
- mcp__playwright__browser_navigate_back
|
|
34
|
+
- mcp__playwright__browser_snapshot
|
|
35
|
+
- mcp__playwright__browser_take_screenshot
|
|
36
|
+
- mcp__playwright__browser_click
|
|
37
|
+
- mcp__playwright__browser_type
|
|
38
|
+
- mcp__playwright__browser_fill_form
|
|
39
|
+
- mcp__playwright__browser_select_option
|
|
40
|
+
- mcp__playwright__browser_hover
|
|
41
|
+
- mcp__playwright__browser_drag
|
|
42
|
+
- mcp__playwright__browser_press_key
|
|
43
|
+
- mcp__playwright__browser_evaluate
|
|
44
|
+
- mcp__playwright__browser_console_messages
|
|
45
|
+
- mcp__playwright__browser_network_requests
|
|
46
|
+
- mcp__playwright__browser_wait_for
|
|
47
|
+
- mcp__playwright__browser_resize
|
|
48
|
+
- mcp__playwright__browser_handle_dialog
|
|
49
|
+
- mcp__playwright__browser_file_upload
|
|
50
|
+
- mcp__playwright__browser_run_code
|
|
51
|
+
- mcp__playwright__browser_tabs
|
|
52
|
+
- mcp__playwright__browser_close
|
|
37
53
|
---
|
|
38
54
|
|
|
39
55
|
<!-- CRITICAL: Plugin Conflict Prevention -->
|
|
@@ -66,7 +82,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
|
|
|
66
82
|
┌────────────────────────────────────────────────────────────┐
|
|
67
83
|
│ │
|
|
68
84
|
│ ####### N E O C O R T E X │
|
|
69
|
-
│ ### ######## v4.0.
|
|
85
|
+
│ ### ######## v4.0.2 │
|
|
70
86
|
│ ######### ##### │
|
|
71
87
|
│ ## ############## Development Orchestrator │
|
|
72
88
|
│ ## ### ###### ## OrNexus Team │
|
|
@@ -119,7 +135,26 @@ neocortex-client invoke \
|
|
|
119
135
|
|
|
120
136
|
## Regras
|
|
121
137
|
|
|
122
|
-
|
|
123
|
-
- NUNCA
|
|
124
|
-
-
|
|
138
|
+
### Orquestracao (triggers `*xxx`)
|
|
139
|
+
- NUNCA invente logica de orquestracao - toda logica de pipeline/step/workflow vem do server
|
|
140
|
+
- NUNCA pule o thin client para argumentos prefixados com `*` - sempre execute `neocortex-client invoke`
|
|
141
|
+
- SEMPRE siga as instrucoes retornadas pelo server literalmente
|
|
125
142
|
- Se o thin client falhar, mostre o erro e aguarde input do usuario
|
|
143
|
+
|
|
144
|
+
### Pesquisa livre / analise (sem prefixo `*`)
|
|
145
|
+
Quando o usuario pedir pesquisa, analise, brainstorm, validacao de hipotese, ou qualquer
|
|
146
|
+
tarefa free-form que NAO seja um trigger de orquestracao, voce TEM permissao para usar
|
|
147
|
+
diretamente as tools disponiveis:
|
|
148
|
+
|
|
149
|
+
- **WebSearch / WebFetch** - pesquisa de mercado, validacao de hipoteses, references reais
|
|
150
|
+
- **Context7 MCP** (`mcp__context7__*`) - documentacao atualizada de libs/frameworks
|
|
151
|
+
- **Playwright MCP** (`mcp__playwright__*`) - screenshots, visual research, scraping
|
|
152
|
+
- **Bash** - qualquer ferramenta CLI (jq, curl, psql, kubectl, docker, fly, gh, etc.)
|
|
153
|
+
- **Read / Write / Edit / Glob / Grep / NotebookEdit** - manipulacao do projeto local
|
|
154
|
+
- **Task** - delegar para subagentes especializados quando util
|
|
155
|
+
- **Skill** - invocar skills do harness quando aplicavel
|
|
156
|
+
|
|
157
|
+
NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
|
|
158
|
+
dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
|
|
159
|
+
precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
|
|
160
|
+
para entrar no fluxo de orquestracao.
|
|
@@ -16,7 +16,7 @@ Codex built-in commands or actions.
|
|
|
16
16
|
|
|
17
17
|
<!-- END: Plugin Conflict Prevention -->
|
|
18
18
|
|
|
19
|
-
# Neocortex v4.0.
|
|
19
|
+
# Neocortex v4.0.2 | OrNexus Team
|
|
20
20
|
|
|
21
21
|
You are a Development Orchestrator. All orchestration logic is delivered by the remote Neocortex server.
|
|
22
22
|
|
|
@@ -55,7 +55,24 @@ neocortex-client invoke \
|
|
|
55
55
|
|
|
56
56
|
## Rules
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
- NEVER
|
|
58
|
+
### Orchestration (triggers `*xxx`)
|
|
59
|
+
- NEVER invent orchestration logic - all pipeline/step/workflow logic comes from the server
|
|
60
|
+
- NEVER skip the thin client for `*`-prefixed arguments - always execute `neocortex-client invoke`
|
|
60
61
|
- ALWAYS follow the returned instructions literally
|
|
61
62
|
- If the thin client fails, show the error and wait for user input
|
|
63
|
+
|
|
64
|
+
### Free research / analysis (no `*` prefix)
|
|
65
|
+
When the user asks for research, analysis, brainstorming, hypothesis validation, or any
|
|
66
|
+
free-form task that is NOT an orchestration trigger, you ARE allowed to use Codex CLI's
|
|
67
|
+
built-in capabilities directly:
|
|
68
|
+
|
|
69
|
+
- **File operations** (`apply_patch`, `shell` / file reads and edits) - local project exploration and edits
|
|
70
|
+
- **Shell commands** (`shell` tool) - any CLI tool (curl, jq, psql, docker, fly, gh, grep, find, etc.)
|
|
71
|
+
to fetch docs, inspect systems, run tests, or gather evidence
|
|
72
|
+
- **MCP servers configured** (context7, playwright, browser_use) - up-to-date library docs,
|
|
73
|
+
browser automation, visual research. See `~/.codex/config.toml` for MCP setup.
|
|
74
|
+
|
|
75
|
+
NEVER refuse research for lack of tools. NEVER fabricate sources - if you cannot find
|
|
76
|
+
real data, say so explicitly. When research leads to decisions that should become
|
|
77
|
+
an epic/stories, invoke `neocortex-client invoke --args "*create-epic ..."` to enter
|
|
78
|
+
the orchestration flow.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: neocortex
|
|
3
|
-
description: "🧠 Neocortex v4.0.
|
|
3
|
+
description: "🧠 Neocortex v4.0.2 | OrNexus Team"
|
|
4
4
|
model: fast
|
|
5
5
|
readonly: false
|
|
6
6
|
is_background: false
|
|
@@ -36,7 +36,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
|
|
|
36
36
|
┌────────────────────────────────────────────────────────────┐
|
|
37
37
|
│ │
|
|
38
38
|
│ ####### N E O C O R T E X │
|
|
39
|
-
│ ### ######## v4.0.
|
|
39
|
+
│ ### ######## v4.0.2 │
|
|
40
40
|
│ ######### ##### │
|
|
41
41
|
│ ## ############## Development Orchestrator │
|
|
42
42
|
│ ## ### ###### ## OrNexus Team │
|
|
@@ -88,7 +88,25 @@ neocortex-client invoke \
|
|
|
88
88
|
|
|
89
89
|
## Regras
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
- NUNCA
|
|
93
|
-
-
|
|
91
|
+
### Orquestracao (triggers `*xxx`)
|
|
92
|
+
- NUNCA invente logica de orquestracao - toda logica de pipeline/step/workflow vem do server
|
|
93
|
+
- NUNCA pule o thin client para argumentos prefixados com `*` - sempre execute `neocortex-client invoke`
|
|
94
|
+
- SEMPRE siga as instrucoes retornadas pelo server literalmente
|
|
94
95
|
- Se o thin client falhar, mostre o erro e aguarde input do usuario
|
|
96
|
+
|
|
97
|
+
### Pesquisa livre / analise (sem prefixo `*`)
|
|
98
|
+
Quando o usuario pedir pesquisa, analise, brainstorm, validacao de hipotese, ou qualquer
|
|
99
|
+
tarefa free-form que NAO seja um trigger de orquestracao, voce TEM permissao para usar
|
|
100
|
+
diretamente as tools do Cursor:
|
|
101
|
+
|
|
102
|
+
- **Codebase search / grep / read file** - exploracao e analise do projeto local
|
|
103
|
+
- **Web search / fetch** - pesquisa de mercado, validacao de hipoteses, references reais
|
|
104
|
+
- **Terminal (`run_terminal`)** - qualquer ferramenta CLI (jq, curl, psql, docker, fly, gh, etc.)
|
|
105
|
+
- **Edit file / apply patch** - manipulacao direta do projeto quando solicitado
|
|
106
|
+
- **MCP servers configurados** (context7, playwright, browser_use) - documentacao atualizada,
|
|
107
|
+
browser automation, visual research
|
|
108
|
+
|
|
109
|
+
NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
|
|
110
|
+
dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
|
|
111
|
+
precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
|
|
112
|
+
para entrar no fluxo de orquestracao.
|