nativesoul 0.1.0
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/CHANGELOG.md +43 -0
- package/LICENSE +19 -0
- package/README.md +384 -0
- package/dist/packages/cli/src/index.js +1066 -0
- package/dist/packages/core/src/secret-patterns.json +25 -0
- package/dist/packages/mcp-server/src/index.js +782 -0
- package/docs/adr/ADR-001-node-first-runtime.md +20 -0
- package/docs/adr/ADR-002-workspace-and-state.md +16 -0
- package/docs/adr/ADR-003-schemas-and-adapter-sdk.md +15 -0
- package/docs/adr/ADR-004-policy-leases-and-heartbeat.md +15 -0
- package/docs/adr/ADR-005-privacy-export-delete-and-supply-chain.md +16 -0
- package/docs/adr/ADR-006-adapter-preview-before-install.md +21 -0
- package/docs/adr/ADR-007-managed-block-backup-and-rollback.md +16 -0
- package/docs/adr/ADR-008-mcp-registration-manifest-before-write.md +16 -0
- package/docs/adr/ADR-009-local-capability-registry.md +16 -0
- package/docs/adr/ADR-010-mcp-capability-tools-read-only.md +15 -0
- package/docs/adr/ADR-011-local-audit-cli-export.md +16 -0
- package/docs/adr/ADR-012-npm-package-runtime-scope.md +16 -0
- package/docs/adr/ADR-013-core-domain-ledger-v1.md +16 -0
- package/docs/adr/ADR-014-memory-lifecycle-v1.md +16 -0
- package/docs/adr/ADR-015-policy-standing-orders-v1.md +16 -0
- package/docs/adr/ADR-016-heartbeat-lease-idempotency-v1.md +16 -0
- package/docs/adr/ADR-017-reversible-mcp-registration-install.md +17 -0
- package/docs/adr/ADR-018-schedule-reconcile-guardrails-v1.md +17 -0
- package/docs/adr/ADR-019-commitments-lifecycle-v1.md +17 -0
- package/docs/adr/ADR-020-mcp-memory-lifecycle-tools.md +16 -0
- package/docs/adr/ADR-021-unified-install-orchestrator-v1.md +17 -0
- package/docs/adr/ADR-022-unified-uninstall-orchestrator-v1.md +20 -0
- package/docs/adr/ADR-023-deep-doctor-install-readiness-v1.md +18 -0
- package/docs/adr/ADR-024-capability-learn-cards-v1.md +18 -0
- package/docs/adr/ADR-025-bootstrap-capability-card-recall-v1.md +18 -0
- package/docs/adr/ADR-026-managed-block-bootstrap-handshake-v1.md +18 -0
- package/docs/adr/ADR-027-local-release-manifest-checksum-v1.md +17 -0
- package/docs/adr/ADR-028-openclaw-workspace-templates-v1.md +47 -0
- package/docs/adr/ADR-029-host-guided-onboarding-v1.md +98 -0
- package/docs/adr/ADR-030-host-surface-matrix-v1.md +93 -0
- package/docs/adr/ADR-031-host-parity-matrix-v2.md +91 -0
- package/docs/adr/ADR-032-nativesoul-hard-cut-rebrand.md +54 -0
- package/docs/adr/ADR-033-local-hybrid-memory-reflection.md +49 -0
- package/docs/adr/ADR-034-memory-importers-provenance.md +38 -0
- package/docs/adr/ADR-035-policy-pack-apply-rollback.md +34 -0
- package/docs/adr/ADR-036-local-operator-dashboard-readonly.md +38 -0
- package/docs/adr/ADR-037-full-native-evidence-contract.md +45 -0
- package/docs/adr/ADR-038-identity-vs-activation-onboarding.md +39 -0
- package/docs/adr/ADR-039-entitlements-offline-licensing.md +47 -0
- package/docs/adr/ADR-040-proprietary-free-to-install-distribution.md +52 -0
- package/docs/adr/ADR-041-project-identity-and-lightweight-registry.md +35 -0
- package/docs/adr/ADR-042-control-plane-direction-and-deferral.md +80 -0
- package/docs/adr/ADR-043-versioning-and-release-policy.md +60 -0
- package/docs/adr/ADR-044-pro-awareness-and-upgrade-nudge-policy.md +53 -0
- package/docs/adr/ADR-045-paid-only-closed-distribution.md +55 -0
- package/docs/legal/EULA.md +70 -0
- package/llm-install.txt +222 -0
- package/package.json +61 -0
- package/plugins/antigravity-nativesoul/GEMINI.md +17 -0
- package/plugins/antigravity-nativesoul/commands/nativesoul-explore.md +22 -0
- package/plugins/antigravity-nativesoul/commands/nativesoul-heartbeat.md +9 -0
- package/plugins/antigravity-nativesoul/commands/nativesoul-plan.md +23 -0
- package/plugins/antigravity-nativesoul/commands/nativesoul-recall.md +16 -0
- package/plugins/antigravity-nativesoul/commands/nativesoul-start.md +9 -0
- package/plugins/antigravity-nativesoul/hooks.json +59 -0
- package/plugins/antigravity-nativesoul/mcp_config.json +8 -0
- package/plugins/antigravity-nativesoul/nativesoul-package.json +22 -0
- package/plugins/antigravity-nativesoul/plugin.json +5 -0
- package/plugins/claude-nativesoul/.claude-plugin/plugin.json +90 -0
- package/plugins/claude-nativesoul/hooks/loader.cjs +23 -0
- package/plugins/claude-nativesoul/hooks/memory-flush.cjs +45 -0
- package/plugins/claude-nativesoul/hooks/pre-tool-use.cjs +53 -0
- package/plugins/claude-nativesoul/hooks/session-start.cjs +108 -0
- package/plugins/claude-nativesoul/hooks/user-prompt-submit.cjs +62 -0
- package/plugins/claude-nativesoul/skills/life-explore/SKILL.md +19 -0
- package/plugins/claude-nativesoul/skills/life-heartbeat/SKILL.md +16 -0
- package/plugins/claude-nativesoul/skills/life-plan/SKILL.md +23 -0
- package/plugins/claude-nativesoul/skills/life-recall/SKILL.md +18 -0
- package/plugins/claude-nativesoul/skills/life-start/SKILL.md +13 -0
- package/plugins/codex-nativesoul/.codex-plugin/plugin.json +83 -0
- package/plugins/codex-nativesoul/.mcp.json +8 -0
- package/plugins/codex-nativesoul/hooks/loader.cjs +23 -0
- package/plugins/codex-nativesoul/hooks/memory-flush.cjs +45 -0
- package/plugins/codex-nativesoul/hooks/pre-tool-use.cjs +53 -0
- package/plugins/codex-nativesoul/hooks/session-start.cjs +119 -0
- package/plugins/codex-nativesoul/hooks/user-prompt-submit.cjs +62 -0
- package/plugins/codex-nativesoul/skills/life-explore/SKILL.md +24 -0
- package/plugins/codex-nativesoul/skills/life-heartbeat/SKILL.md +21 -0
- package/plugins/codex-nativesoul/skills/life-plan/SKILL.md +28 -0
- package/plugins/codex-nativesoul/skills/life-recall/SKILL.md +23 -0
- package/plugins/codex-nativesoul/skills/life-start/SKILL.md +18 -0
- package/plugins/gemini-nativesoul/GEMINI.md +17 -0
- package/plugins/gemini-nativesoul/commands/nativesoul-explore.toml +3 -0
- package/plugins/gemini-nativesoul/commands/nativesoul-heartbeat.toml +2 -0
- package/plugins/gemini-nativesoul/commands/nativesoul-plan.toml +3 -0
- package/plugins/gemini-nativesoul/commands/nativesoul-recall.toml +3 -0
- package/plugins/gemini-nativesoul/commands/nativesoul-start.toml +2 -0
- package/plugins/gemini-nativesoul/gemini-extension.json +16 -0
- package/plugins/gemini-nativesoul/hooks/hooks.json +59 -0
- package/plugins/grok-nativesoul/.mcp.json +8 -0
- package/plugins/grok-nativesoul/AGENTS.md +17 -0
- package/plugins/grok-nativesoul/commands/nativesoul-explore.md +22 -0
- package/plugins/grok-nativesoul/commands/nativesoul-heartbeat.md +9 -0
- package/plugins/grok-nativesoul/commands/nativesoul-plan.md +23 -0
- package/plugins/grok-nativesoul/commands/nativesoul-recall.md +16 -0
- package/plugins/grok-nativesoul/commands/nativesoul-start.md +9 -0
- package/plugins/grok-nativesoul/hooks/hooks.json +59 -0
- package/plugins/grok-nativesoul/nativesoul-package.json +22 -0
- package/plugins/grok-nativesoul/plugin.json +5 -0
- package/plugins/shared/hooks/host-hook.cjs +207 -0
- package/plugins/shared/hooks/lib.cjs +279 -0
- package/plugins/shared/hooks/policy-fail-closed.cjs +95 -0
- package/policy-packs/local-readonly.json +47 -0
- package/policy-packs/team-review.json +49 -0
- package/schemas/audit-event.schema.json +18 -0
- package/schemas/capability-card.schema.json +37 -0
- package/schemas/capability.schema.json +25 -0
- package/schemas/commitment.schema.json +19 -0
- package/schemas/full-native-evidence.schema.json +82 -0
- package/schemas/lease.schema.json +16 -0
- package/schemas/memory.schema.json +31 -0
- package/schemas/migration.schema.json +14 -0
- package/schemas/policy-pack.schema.json +96 -0
- package/schemas/schedule.schema.json +16 -0
- package/schemas/session.schema.json +16 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-nativesoul",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "NativeSoul continuity bootstrap for Codex sessions.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "NativeSoul",
|
|
7
|
+
"email": "noreply@example.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": ["nativesoul", "continuity", "bootstrap", "codex"],
|
|
11
|
+
"skills": "./skills/",
|
|
12
|
+
"mcpServers": "./.mcp.json",
|
|
13
|
+
"hooks": {
|
|
14
|
+
"SessionStart": [
|
|
15
|
+
{
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "node hooks/session-start.cjs",
|
|
20
|
+
"timeout": 10
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"Stop": [
|
|
26
|
+
{
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "node hooks/memory-flush.cjs",
|
|
31
|
+
"timeout": 10
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"PreCompact": [
|
|
37
|
+
{
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"command": "node hooks/memory-flush.cjs",
|
|
42
|
+
"timeout": 10
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"UserPromptSubmit": [
|
|
48
|
+
{
|
|
49
|
+
"hooks": [
|
|
50
|
+
{
|
|
51
|
+
"type": "command",
|
|
52
|
+
"command": "node hooks/user-prompt-submit.cjs",
|
|
53
|
+
"timeout": 10
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"PreToolUse": [
|
|
59
|
+
{
|
|
60
|
+
"hooks": [
|
|
61
|
+
{
|
|
62
|
+
"type": "command",
|
|
63
|
+
"command": "node hooks/pre-tool-use.cjs",
|
|
64
|
+
"timeout": 10
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"interface": {
|
|
71
|
+
"displayName": "NativeSoul",
|
|
72
|
+
"shortDescription": "Local continuity bootstrap for Codex sessions.",
|
|
73
|
+
"longDescription": "Loads NativeSoul identity, operating context, project memory, and fallback cache at Codex session start.",
|
|
74
|
+
"developerName": "NativeSoul",
|
|
75
|
+
"category": "Productivity",
|
|
76
|
+
"capabilities": ["Local", "Context"],
|
|
77
|
+
"defaultPrompt": [
|
|
78
|
+
"Start this Codex session with NativeSoul context.",
|
|
79
|
+
"Recall my NativeSoul project memory.",
|
|
80
|
+
"Check NativeSoul bootstrap status."
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
|
|
6
|
+
function sharedRoots(fromDir) {
|
|
7
|
+
return [
|
|
8
|
+
path.join(fromDir, '..', 'shared', 'hooks'),
|
|
9
|
+
path.join(fromDir, '..', '..', 'shared', 'hooks')
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function loadShared(fromDir, name) {
|
|
14
|
+
for (const root of sharedRoots(fromDir)) {
|
|
15
|
+
const candidate = path.join(root, name);
|
|
16
|
+
if (fs.existsSync(candidate)) {
|
|
17
|
+
return require(candidate);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`NativeSoul shared hook module not found: ${name}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { loadShared, sharedRoots };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { loadShared } = require('./loader.cjs');
|
|
5
|
+
const lib = loadShared(__dirname, 'lib.cjs');
|
|
6
|
+
|
|
7
|
+
const HOOK_TIMEOUT_MS = lib.DEFAULT_HOOK_TIMEOUT_MS;
|
|
8
|
+
const HOST = 'codex';
|
|
9
|
+
const PROJECT_ENV = 'CODEX_PROJECT_DIR';
|
|
10
|
+
|
|
11
|
+
function flushArgs(input) {
|
|
12
|
+
const cwd = lib.resolveProjectDir(input, PROJECT_ENV);
|
|
13
|
+
const event = input.hook_event_name || input.event || 'Stop';
|
|
14
|
+
return lib.appendHomeArg(['memory', 'flush-hook', '--host', HOST, '--cwd', cwd, '--event', event, '--json']);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function runNativeSoul(input) {
|
|
18
|
+
return lib.spawnNativeSoul(flushArgs(input), {
|
|
19
|
+
input: `${JSON.stringify(input)}\n`,
|
|
20
|
+
timeout: HOOK_TIMEOUT_MS
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
const input = await lib.readStdin();
|
|
26
|
+
runNativeSoul(input);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function run() {
|
|
30
|
+
lib.runNonBlocking(main, HOOK_TIMEOUT_MS);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (require.main === module) {
|
|
34
|
+
run();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
HOOK_TIMEOUT_MS,
|
|
39
|
+
HOST,
|
|
40
|
+
flushArgs,
|
|
41
|
+
readStdin: lib.readStdin,
|
|
42
|
+
runNativeSoul,
|
|
43
|
+
main,
|
|
44
|
+
run
|
|
45
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { loadShared } = require('./loader.cjs');
|
|
5
|
+
const lib = loadShared(__dirname, 'lib.cjs');
|
|
6
|
+
const policy = loadShared(__dirname, 'policy-fail-closed.cjs');
|
|
7
|
+
|
|
8
|
+
const HOOK_TIMEOUT_MS = lib.DEFAULT_HOOK_TIMEOUT_MS;
|
|
9
|
+
const HOST = 'codex';
|
|
10
|
+
const PROJECT_ENV = 'CODEX_PROJECT_DIR';
|
|
11
|
+
|
|
12
|
+
function policyArgs(input) {
|
|
13
|
+
const cwd = lib.resolveProjectDir(input, PROJECT_ENV);
|
|
14
|
+
return lib.appendHomeArg(['policy', 'pretooluse-hook', '--host', HOST, '--cwd', cwd, '--json']);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function runNativeSoul(input) {
|
|
18
|
+
const result = lib.spawnNativeSoul(policyArgs(input), {
|
|
19
|
+
input: `${JSON.stringify(input)}\n`,
|
|
20
|
+
timeout: HOOK_TIMEOUT_MS
|
|
21
|
+
});
|
|
22
|
+
const parsed = lib.parseJsonStdout(result);
|
|
23
|
+
return parsed ?? policy.buildFailClosedPreToolUseResult(input);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
const input = await lib.readStdin({ fallback: (raw) => ({ raw }) });
|
|
28
|
+
const result = runNativeSoul(input);
|
|
29
|
+
const output = lib.buildPreToolUseHookOutput(result);
|
|
30
|
+
if (output) {
|
|
31
|
+
process.stdout.write(`${JSON.stringify(output)}\n`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function run() {
|
|
36
|
+
lib.runNonBlocking(main, HOOK_TIMEOUT_MS);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (require.main === module) {
|
|
40
|
+
run();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
HOOK_TIMEOUT_MS,
|
|
45
|
+
HOST,
|
|
46
|
+
buildHookOutput: lib.buildPreToolUseHookOutput,
|
|
47
|
+
fallbackPolicyResult: policy.buildFailClosedPreToolUseResult,
|
|
48
|
+
policyArgs,
|
|
49
|
+
readStdin: lib.readStdin,
|
|
50
|
+
runNativeSoul,
|
|
51
|
+
main,
|
|
52
|
+
run
|
|
53
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { loadShared } = require('./loader.cjs');
|
|
5
|
+
const lib = loadShared(__dirname, 'lib.cjs');
|
|
6
|
+
|
|
7
|
+
const HOOK_TIMEOUT_MS = lib.DEFAULT_HOOK_TIMEOUT_MS;
|
|
8
|
+
const HOST = 'codex';
|
|
9
|
+
const PROJECT_ENV = 'CODEX_PROJECT_DIR';
|
|
10
|
+
|
|
11
|
+
function bootstrapArgs(input, format) {
|
|
12
|
+
const cwd = lib.resolveProjectDir(input, PROJECT_ENV);
|
|
13
|
+
return lib.appendHomeArg(['bootstrap', '--host', HOST, '--cwd', cwd, '--format', format, '--json']);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function capabilityRefreshArgs() {
|
|
17
|
+
const args = ['capabilities', 'refresh', '--host', HOST, '--delta', '--json'];
|
|
18
|
+
lib.appendHomeArg(args);
|
|
19
|
+
const ttl = process.env.NATIVESOUL_CAPABILITY_REFRESH_TTL_SECONDS;
|
|
20
|
+
if (ttl && ttl.trim().length > 0) {
|
|
21
|
+
args.push('--ttl-seconds', ttl.trim());
|
|
22
|
+
}
|
|
23
|
+
return args;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function runCapabilityRefresh() {
|
|
27
|
+
const result = lib.spawnNativeSoul(capabilityRefreshArgs(), {
|
|
28
|
+
timeout: 1900,
|
|
29
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
30
|
+
});
|
|
31
|
+
if (result.status !== 0) {
|
|
32
|
+
return { stale: true };
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const parsed = JSON.parse(result.stdout);
|
|
36
|
+
const stale = Array.isArray(parsed) && parsed.some((item) => item && item.status === 'degraded');
|
|
37
|
+
const skipped = Array.isArray(parsed) && parsed.every((item) => item && item.skipped === true);
|
|
38
|
+
return { stale, skipped };
|
|
39
|
+
} catch {
|
|
40
|
+
return { stale: true };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function runCapabilityLearn() {
|
|
45
|
+
lib.spawnNativeSoul(lib.appendHomeArg(['capabilities', 'learn', '--host', HOST, '--json']), {
|
|
46
|
+
timeout: 1900,
|
|
47
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function runNativeSoul(input, format) {
|
|
52
|
+
const result = lib.spawnNativeSoul(bootstrapArgs(input, format), {
|
|
53
|
+
timeout: HOOK_TIMEOUT_MS,
|
|
54
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
55
|
+
});
|
|
56
|
+
return lib.parseJsonStdout(result);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function writeProjectFallbackCache(input, context) {
|
|
60
|
+
const cwd = lib.resolveProjectDir(input, PROJECT_ENV);
|
|
61
|
+
return lib.writeProjectFallbackCache({ context, cwd, host: HOST });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function readProjectFallbackCache(input) {
|
|
65
|
+
const cwd = lib.resolveProjectDir(input, PROJECT_ENV);
|
|
66
|
+
return lib.readProjectFallbackCache({ cwd, host: HOST });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function buildHookOutput(context) {
|
|
70
|
+
const outputContext = context.capabilityRefreshStale
|
|
71
|
+
? `${context.content}\n\nwarnings:\n- CAPABILITY_REFRESH_STALE`
|
|
72
|
+
: context.content;
|
|
73
|
+
return {
|
|
74
|
+
context: outputContext,
|
|
75
|
+
degraded: context.degraded === true,
|
|
76
|
+
source: 'nativesoul'
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function main() {
|
|
81
|
+
const input = await lib.readStdin({ fallback: () => ({}) });
|
|
82
|
+
const capabilityRefresh = runCapabilityRefresh();
|
|
83
|
+
if (!capabilityRefresh.stale && !capabilityRefresh.skipped) {
|
|
84
|
+
runCapabilityLearn();
|
|
85
|
+
}
|
|
86
|
+
const injected = writeProjectFallbackCache(input, runNativeSoul(input, 'inject'));
|
|
87
|
+
const context = injected && typeof injected.content === 'string'
|
|
88
|
+
? injected
|
|
89
|
+
: runNativeSoul(input, 'cache') || readProjectFallbackCache(input);
|
|
90
|
+
|
|
91
|
+
if (!context || typeof context.content !== 'string') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
process.stdout.write(`${JSON.stringify(buildHookOutput({ ...context, capabilityRefreshStale: capabilityRefresh.stale }))}\n`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function run() {
|
|
99
|
+
lib.runNonBlocking(main, HOOK_TIMEOUT_MS);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (require.main === module) {
|
|
103
|
+
run();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
HOOK_TIMEOUT_MS,
|
|
108
|
+
bootstrapArgs,
|
|
109
|
+
capabilityRefreshArgs,
|
|
110
|
+
buildHookOutput,
|
|
111
|
+
readStdin: lib.readStdin,
|
|
112
|
+
runCapabilityRefresh,
|
|
113
|
+
runCapabilityLearn,
|
|
114
|
+
runNativeSoul,
|
|
115
|
+
writeProjectFallbackCache,
|
|
116
|
+
readProjectFallbackCache,
|
|
117
|
+
main,
|
|
118
|
+
run
|
|
119
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { loadShared } = require('./loader.cjs');
|
|
5
|
+
const lib = loadShared(__dirname, 'lib.cjs');
|
|
6
|
+
|
|
7
|
+
const HOOK_TIMEOUT_MS = lib.DEFAULT_HOOK_TIMEOUT_MS;
|
|
8
|
+
const HOST = 'codex';
|
|
9
|
+
const PROJECT_ENV = 'CODEX_PROJECT_DIR';
|
|
10
|
+
|
|
11
|
+
function recallArgs(input) {
|
|
12
|
+
const cwd = lib.resolveProjectDir(input, PROJECT_ENV);
|
|
13
|
+
return lib.appendHomeArg(['memory', 'recall-hook', '--host', HOST, '--cwd', cwd, '--json']);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function runNativeSoul(input) {
|
|
17
|
+
const result = lib.spawnNativeSoul(recallArgs(input), {
|
|
18
|
+
input: `${JSON.stringify(input)}\n`,
|
|
19
|
+
timeout: HOOK_TIMEOUT_MS
|
|
20
|
+
});
|
|
21
|
+
return lib.parseJsonStdout(result);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function buildHookOutput(result) {
|
|
25
|
+
if (!result || typeof result.context !== 'string' || result.context.length === 0) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
hookSpecificOutput: {
|
|
30
|
+
hookEventName: 'UserPromptSubmit',
|
|
31
|
+
additionalContext: result.context
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function main() {
|
|
37
|
+
const input = await lib.readStdin({ fallback: (raw) => ({ prompt: raw }) });
|
|
38
|
+
const result = runNativeSoul(input);
|
|
39
|
+
const output = buildHookOutput(result);
|
|
40
|
+
if (output) {
|
|
41
|
+
process.stdout.write(`${JSON.stringify(output)}\n`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function run() {
|
|
46
|
+
lib.runNonBlocking(main, HOOK_TIMEOUT_MS);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (require.main === module) {
|
|
50
|
+
run();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
HOOK_TIMEOUT_MS,
|
|
55
|
+
HOST,
|
|
56
|
+
buildHookOutput,
|
|
57
|
+
recallArgs,
|
|
58
|
+
readStdin: lib.readStdin,
|
|
59
|
+
runNativeSoul,
|
|
60
|
+
main,
|
|
61
|
+
run
|
|
62
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: life-explore
|
|
3
|
+
description: Explore a project locally with NativeSoul context using bounded read-only discovery.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# life:explore
|
|
7
|
+
|
|
8
|
+
Use this skill when the operator asks to explore a codebase, find current implementation boundaries, or map what exists.
|
|
9
|
+
|
|
10
|
+
Default policy: read-only and bounded. Never edit files, run migrations, install packages, start background services, or trigger external writes from this skill.
|
|
11
|
+
|
|
12
|
+
1. Load context with MCP `life_bootstrap` using `host="codex"` and the current working directory.
|
|
13
|
+
2. Inspect capability readiness using `nativesoul dashboard data --host codex --limit 25 --json` or MCP capability tools.
|
|
14
|
+
3. Scope exploration to the operator's request. Prefer targeted file discovery such as:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
rg --files
|
|
18
|
+
rg "<specific term from the task>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
4. Avoid broad unbounded scans. If the task is vague, inspect only high-signal files first: README, package metadata, docs, stories, ADRs, and nearby source modules.
|
|
22
|
+
5. Report findings with file paths and distinguish verified code facts from memory-derived or inferred context.
|
|
23
|
+
6. If a write, install, network call, scheduler mutation, or policy change seems needed, stop and ask for normal approval instead of performing it inside this skill.
|
|
24
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: life-heartbeat
|
|
3
|
+
description: Run NativeSoul heartbeat from a Codex Automation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# life:heartbeat
|
|
7
|
+
|
|
8
|
+
Use this skill only when invoked by a Codex Automation for NativeSoul heartbeat checks.
|
|
9
|
+
|
|
10
|
+
Default policy: read-only. Do not edit workspace files, memories, `SOUL.md`, `POLICY.md`, automation state, or host configuration unless the operator explicitly approves a follow-up change.
|
|
11
|
+
|
|
12
|
+
1. Determine the project from the Automation context. If it is missing, use the current working directory.
|
|
13
|
+
2. Claim a local heartbeat lease through MCP `life_heartbeat_claim` with `host="codex"`, the project id or directory, and the Automation slot/time as `slot`.
|
|
14
|
+
3. If another host owns the lease, the lease is already completed, or no work is needed, stop and return only `HEARTBEAT_OK`.
|
|
15
|
+
4. Read NativeSoul context through MCP/read-only commands and inspect heartbeat guidance such as `HEARTBEAT.md`.
|
|
16
|
+
5. If no operator-visible action is required, complete the lease with MCP `life_heartbeat_complete` and `result="HEARTBEAT_OK"`, then return only `HEARTBEAT_OK`.
|
|
17
|
+
6. If action is required, complete the lease with concise evidence, then report the action request without secrets or raw credentials.
|
|
18
|
+
|
|
19
|
+
`HEARTBEAT_OK` is a silent acknowledgement token. Do not notify the user for it.
|
|
20
|
+
|
|
21
|
+
Never create a cron fallback. If Codex Automations are unavailable, the adapter must report unsupported and leave local schedule state as unsupported.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: life-plan
|
|
3
|
+
description: Build a local NativeSoul execution plan from dashboard, commitments, schedules, and capability state.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# life:plan
|
|
7
|
+
|
|
8
|
+
Use this skill when the operator asks for a NativeSoul-aware plan before execution.
|
|
9
|
+
|
|
10
|
+
Default policy: read-only. Do not apply schedules, policy packs, onboarding changes, memory transitions, or workspace edits unless the operator explicitly approves the next action.
|
|
11
|
+
|
|
12
|
+
1. Load context with MCP `life_bootstrap` using `host="codex"` and the current working directory.
|
|
13
|
+
2. Read local dashboard state:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
nativesoul dashboard data --host codex --limit 25 --json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Read open commitments if needed:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
nativesoul commitments list --project <project-id> --status open --limit 25 --json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
4. Read capability readiness with `nativesoul capabilities list --host codex --limit 25 --json`.
|
|
26
|
+
5. Produce a plan that separates implemented state, degraded/fallback state, and approval-required actions.
|
|
27
|
+
6. Do not claim a host feature is native unless the capability evidence says `full native capability`.
|
|
28
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: life-recall
|
|
3
|
+
description: Recall NativeSoul project memory and capability context for the current Codex task.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# life:recall
|
|
7
|
+
|
|
8
|
+
Use this skill when the operator asks for prior context, project memory, or continuity before a Codex task.
|
|
9
|
+
|
|
10
|
+
Default policy: read-only. Do not create, promote, reject, forget, or edit memories unless the operator explicitly asks for that policy flow.
|
|
11
|
+
|
|
12
|
+
1. Determine the current working directory and concise task query.
|
|
13
|
+
2. Prefer MCP `life_recall` with `host="codex"`, the current project/cwd, and the task query.
|
|
14
|
+
3. If MCP is unavailable, run:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
nativesoul memory recall-hook --host codex --cwd "$PWD" --prompt "<task query>" --limit 8 --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
4. If recall output is empty, say no durable memory was found; do not invent context.
|
|
21
|
+
5. Treat recovered memory as advisory and verify against repository files before making code decisions.
|
|
22
|
+
6. Include capability readiness honestly when relevant: `ready`, `full native capability`, `official-fallback`, or `degraded`.
|
|
23
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: life-start
|
|
3
|
+
description: Load NativeSoul continuity context at the start of a Codex session.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# life:start
|
|
7
|
+
|
|
8
|
+
Use this skill at the start of a Codex session when NativeSoul context is needed.
|
|
9
|
+
|
|
10
|
+
1. Prefer the session hook context if it is already present.
|
|
11
|
+
2. If context is missing, call MCP `life_bootstrap` with `host="codex"` and the current working directory.
|
|
12
|
+
3. If MCP is unavailable, run:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
nativesoul bootstrap --host codex --cwd "$PWD" --format cache
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Follow the injected `soul_summary`, `agents_operating_summary`, policy hints, and project context. Do not edit `SOUL.md` or `POLICY.md` directly; propose changes for approval.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- nativesoul:start v1 -->
|
|
2
|
+
# NativeSoul bridge for Gemini CLI
|
|
3
|
+
|
|
4
|
+
At the start of continuity-sensitive work, load NativeSoul context.
|
|
5
|
+
|
|
6
|
+
Preferred path: use MCP `life_bootstrap` with `host="gemini"` and the current working directory.
|
|
7
|
+
|
|
8
|
+
Fallback path: run `nativesoul bootstrap --host gemini --cwd <current-working-directory> --format inject --json`.
|
|
9
|
+
|
|
10
|
+
Use `/memory refresh` after installing or updating this extension so Gemini reloads this context.
|
|
11
|
+
|
|
12
|
+
Use `relevant_memories` for durable facts, `capability_cards` as advisory guidance, and `capabilities` only as the ready-only list.
|
|
13
|
+
|
|
14
|
+
Never copy credentials or auto-edit `SOUL.md`/`POLICY.md`; propose those changes for approval.
|
|
15
|
+
|
|
16
|
+
Host adapter: gemini.
|
|
17
|
+
<!-- nativesoul:end -->
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
description = "Explore a project locally with NativeSoul context using bounded read-only discovery."
|
|
2
|
+
prompt = "Explore the current project in read-only mode. Load NativeSoul context with host=\"gemini\", inspect `nativesoul dashboard data --host gemini --limit 25 --json`, then use targeted local discovery such as `rg --files` and `rg <specific term>` scoped to the operator request. Avoid broad unbounded scans. Never edit files, install packages, start services, create schedulers, or perform external writes from this command; ask for normal approval if a write is needed."
|
|
3
|
+
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
description = "Run an NativeSoul heartbeat tick through Gemini CLI without installing a hidden scheduler."
|
|
2
|
+
prompt = "Run an NativeSoul heartbeat for this project using MCP life_heartbeat_claim with host=\"gemini\". If the claim returns HEARTBEAT_OK or no work is available, do not notify the user. Complete the lease with life_heartbeat_complete only if Gemini won the lease."
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
description = "Build a read-only NativeSoul execution plan from local dashboard and capability state."
|
|
2
|
+
prompt = "Build a read-only plan using NativeSoul local state. Call MCP life_bootstrap with host=\"gemini\", then read `nativesoul dashboard data --host gemini --limit 25 --json`, open commitments when relevant, and `nativesoul capabilities list --host gemini --limit 25 --json`. Separate implemented state, degraded/fallback state, and approval-required actions. Do not mutate schedules, memory, policy, or files unless the operator explicitly approves a later action."
|
|
3
|
+
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
description = "Recall NativeSoul project memory and capability context for the current Gemini task."
|
|
2
|
+
prompt = "Run a read-only NativeSoul recall for the current task. Prefer MCP life_recall with host=\"gemini\" and the current working directory. If MCP is unavailable, run `nativesoul memory recall-hook --host gemini --cwd <current-working-directory> --prompt <task query> --limit 8 --json`. Treat recovered memory as advisory, verify against files, and report capability readiness honestly as ready, full native capability, official-fallback, or degraded."
|
|
3
|
+
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
description = "Load NativeSoul context for the current Gemini workspace."
|
|
2
|
+
prompt = "Call MCP life_bootstrap with host=\"gemini\" and the current working directory. If MCP is unavailable, run `nativesoul bootstrap --host gemini --cwd <current-working-directory> --format inject --json` and follow the returned context."
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nativesoul",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpServers": {
|
|
5
|
+
"nativesoul": {
|
|
6
|
+
"command": "nativesoul-mcp",
|
|
7
|
+
"args": []
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"contextFileName": "GEMINI.md",
|
|
11
|
+
"excludeTools": [
|
|
12
|
+
"run_shell_command(rm -rf)",
|
|
13
|
+
"run_shell_command(git push)",
|
|
14
|
+
"run_shell_command(npm publish)"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "node ${extensionPath}/shared/hooks/host-hook.cjs session-start --host gemini --project-env GEMINI_CWD",
|
|
9
|
+
"timeout": 9
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"BeforeAgent": [
|
|
15
|
+
{
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "node ${extensionPath}/shared/hooks/host-hook.cjs prompt-bootstrap --host gemini --project-env GEMINI_CWD --event BeforeAgent",
|
|
20
|
+
"timeout": 9
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"BeforeTool": [
|
|
26
|
+
{
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "node ${extensionPath}/shared/hooks/host-hook.cjs pre-tool-use --host gemini --project-env GEMINI_CWD --event BeforeTool",
|
|
31
|
+
"timeout": 9
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"AfterAgent": [
|
|
37
|
+
{
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"command": "node ${extensionPath}/shared/hooks/host-hook.cjs memory-flush --host gemini --project-env GEMINI_CWD --event AfterAgent",
|
|
42
|
+
"timeout": 9
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"PreCompress": [
|
|
48
|
+
{
|
|
49
|
+
"hooks": [
|
|
50
|
+
{
|
|
51
|
+
"type": "command",
|
|
52
|
+
"command": "node ${extensionPath}/shared/hooks/host-hook.cjs memory-flush --host gemini --project-env GEMINI_CWD --event PreCompress",
|
|
53
|
+
"timeout": 9
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- nativesoul:start v1 -->
|
|
2
|
+
# NativeSoul bridge for Grok
|
|
3
|
+
|
|
4
|
+
At the start of continuity-sensitive work, load NativeSoul context.
|
|
5
|
+
|
|
6
|
+
Preferred path: use MCP `life_bootstrap` with `host="grok"` and the current working directory.
|
|
7
|
+
|
|
8
|
+
Fallback path: run `nativesoul bootstrap --host grok --cwd <current-working-directory> --format inject --json`.
|
|
9
|
+
|
|
10
|
+
Use `relevant_memories` for durable facts, `capability_cards` as advisory guidance, and `capabilities` only as the ready-only list.
|
|
11
|
+
|
|
12
|
+
Native hooks and scheduler support are not declared unless Grok official documentation exposes them. Do not create cron, daemons, or sidecars.
|
|
13
|
+
|
|
14
|
+
Never copy credentials or auto-edit `SOUL.md`/`POLICY.md`; propose those changes for approval.
|
|
15
|
+
|
|
16
|
+
Host adapter: grok.
|
|
17
|
+
<!-- nativesoul:end -->
|