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,22 @@
|
|
|
1
|
+
# nativesoul-explore
|
|
2
|
+
|
|
3
|
+
Explore the current project with NativeSoul context.
|
|
4
|
+
|
|
5
|
+
Default policy: read-only and bounded. Do not edit files, install packages, start services, create schedulers, or perform external writes.
|
|
6
|
+
|
|
7
|
+
1. Call MCP `life_bootstrap` with `host="antigravity"`.
|
|
8
|
+
2. Inspect readiness with:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
nativesoul dashboard data --host antigravity --limit 25 --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
3. Scope discovery to the operator request. Prefer targeted local reads:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
rg --files
|
|
18
|
+
rg "<specific term from the task>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
4. Avoid broad unbounded scans. If a write is needed, stop and ask for normal approval.
|
|
22
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# nativesoul-heartbeat
|
|
2
|
+
|
|
3
|
+
Run a heartbeat tick without creating a hidden scheduler:
|
|
4
|
+
|
|
5
|
+
1. Claim a lease with host `antigravity`.
|
|
6
|
+
2. If the result is `HEARTBEAT_OK`, stay silent.
|
|
7
|
+
3. Complete only leases won by Antigravity.
|
|
8
|
+
|
|
9
|
+
Native schedule status remains `native_schedule_supported=false` until Antigravity documents an official scheduler surface.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# nativesoul-plan
|
|
2
|
+
|
|
3
|
+
Build a NativeSoul-aware plan for the current Antigravity task.
|
|
4
|
+
|
|
5
|
+
Default policy: read-only.
|
|
6
|
+
|
|
7
|
+
1. Call MCP `life_bootstrap` with `host="antigravity"` and the current working directory.
|
|
8
|
+
2. Read dashboard state:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
nativesoul dashboard data --host antigravity --limit 25 --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
3. Read commitments and capabilities when relevant:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
nativesoul commitments list --project <project-id> --status open --limit 25 --json
|
|
18
|
+
nativesoul capabilities list --host antigravity --limit 25 --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
4. Separate implemented, degraded/fallback, and approval-required work.
|
|
22
|
+
5. Do not mutate schedules, memory, policy, or files without explicit approval.
|
|
23
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# nativesoul-recall
|
|
2
|
+
|
|
3
|
+
Recall NativeSoul project memory and capability context for the current Antigravity task.
|
|
4
|
+
|
|
5
|
+
Default policy: read-only.
|
|
6
|
+
|
|
7
|
+
1. Prefer MCP `life_recall` with `host="antigravity"` and the current working directory.
|
|
8
|
+
2. If MCP is unavailable, run:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
nativesoul memory recall-hook --host antigravity --cwd "$PWD" --prompt "<task query>" --limit 8 --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
3. Treat recovered memory as advisory and verify against files.
|
|
15
|
+
4. Report readiness honestly as `ready`, `full native capability`, `official-fallback`, or `degraded`.
|
|
16
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "node \"shared/hooks/host-hook.cjs\" session-start --host antigravity --project-env GEMINI_CWD",
|
|
9
|
+
"timeout": 9
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"UserPromptSubmit": [
|
|
15
|
+
{
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "node \"shared/hooks/host-hook.cjs\" prompt-bootstrap --host antigravity --project-env GEMINI_CWD",
|
|
20
|
+
"timeout": 9
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"PreToolUse": [
|
|
26
|
+
{
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "node \"shared/hooks/host-hook.cjs\" pre-tool-use --host antigravity --project-env GEMINI_CWD",
|
|
31
|
+
"timeout": 9
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"Stop": [
|
|
37
|
+
{
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"command": "node \"shared/hooks/host-hook.cjs\" memory-flush --host antigravity --project-env GEMINI_CWD",
|
|
42
|
+
"timeout": 9
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"PreCompact": [
|
|
48
|
+
{
|
|
49
|
+
"hooks": [
|
|
50
|
+
{
|
|
51
|
+
"type": "command",
|
|
52
|
+
"command": "node \"shared/hooks/host-hook.cjs\" memory-flush --host antigravity --project-env GEMINI_CWD",
|
|
53
|
+
"timeout": 9
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "antigravity-nativesoul",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"nativeSoul": {
|
|
5
|
+
"host": "antigravity",
|
|
6
|
+
"packageKind": "native-plugin",
|
|
7
|
+
"nativeHooksSupported": true,
|
|
8
|
+
"nativeSchedulerSupported": false,
|
|
9
|
+
"mcpServer": {
|
|
10
|
+
"name": "nativesoul",
|
|
11
|
+
"command": "nativesoul-mcp",
|
|
12
|
+
"args": []
|
|
13
|
+
},
|
|
14
|
+
"commands": [
|
|
15
|
+
"nativesoul-start",
|
|
16
|
+
"nativesoul-heartbeat",
|
|
17
|
+
"nativesoul-recall",
|
|
18
|
+
"nativesoul-plan",
|
|
19
|
+
"nativesoul-explore"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nativesoul",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "NativeSoul continuity bootstrap for Claude Code sessions.",
|
|
5
|
+
"mcpServers": {
|
|
6
|
+
"nativesoul": {
|
|
7
|
+
"command": "nativesoul-mcp",
|
|
8
|
+
"args": []
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"hooks": {
|
|
12
|
+
"SessionStart": [
|
|
13
|
+
{
|
|
14
|
+
"hooks": [
|
|
15
|
+
{
|
|
16
|
+
"type": "command",
|
|
17
|
+
"command": "node hooks/session-start.cjs",
|
|
18
|
+
"timeout": 10
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"Stop": [
|
|
24
|
+
{
|
|
25
|
+
"hooks": [
|
|
26
|
+
{
|
|
27
|
+
"type": "command",
|
|
28
|
+
"command": "node hooks/memory-flush.cjs",
|
|
29
|
+
"timeout": 10
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"PreCompact": [
|
|
35
|
+
{
|
|
36
|
+
"hooks": [
|
|
37
|
+
{
|
|
38
|
+
"type": "command",
|
|
39
|
+
"command": "node hooks/memory-flush.cjs",
|
|
40
|
+
"timeout": 10
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"UserPromptSubmit": [
|
|
46
|
+
{
|
|
47
|
+
"hooks": [
|
|
48
|
+
{
|
|
49
|
+
"type": "command",
|
|
50
|
+
"command": "node hooks/user-prompt-submit.cjs",
|
|
51
|
+
"timeout": 10
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"PreToolUse": [
|
|
57
|
+
{
|
|
58
|
+
"hooks": [
|
|
59
|
+
{
|
|
60
|
+
"type": "command",
|
|
61
|
+
"command": "node hooks/pre-tool-use.cjs",
|
|
62
|
+
"timeout": 10
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"skills": [
|
|
69
|
+
{
|
|
70
|
+
"name": "life:start",
|
|
71
|
+
"path": "skills/life-start/SKILL.md"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "life:heartbeat",
|
|
75
|
+
"path": "skills/life-heartbeat/SKILL.md"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "life:recall",
|
|
79
|
+
"path": "skills/life-recall/SKILL.md"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "life:plan",
|
|
83
|
+
"path": "skills/life-plan/SKILL.md"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "life:explore",
|
|
87
|
+
"path": "skills/life-explore/SKILL.md"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
@@ -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 = 'claude';
|
|
9
|
+
const PROJECT_ENV = 'CLAUDE_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 = 'claude';
|
|
10
|
+
const PROJECT_ENV = 'CLAUDE_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,108 @@
|
|
|
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 = 'claude';
|
|
9
|
+
const PROJECT_ENV = 'CLAUDE_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 buildHookOutput(context) {
|
|
60
|
+
const additionalContext = context.capabilityRefreshStale
|
|
61
|
+
? `${context.content}\n\nwarnings:\n- CAPABILITY_REFRESH_STALE`
|
|
62
|
+
: context.content;
|
|
63
|
+
return {
|
|
64
|
+
hookSpecificOutput: {
|
|
65
|
+
hookEventName: 'SessionStart',
|
|
66
|
+
additionalContext
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function main() {
|
|
72
|
+
const input = await lib.readStdin({ fallback: () => ({}) });
|
|
73
|
+
const capabilityRefresh = runCapabilityRefresh();
|
|
74
|
+
if (!capabilityRefresh.stale && !capabilityRefresh.skipped) {
|
|
75
|
+
runCapabilityLearn();
|
|
76
|
+
}
|
|
77
|
+
const injected = runNativeSoul(input, 'inject');
|
|
78
|
+
const context = injected && typeof injected.content === 'string'
|
|
79
|
+
? injected
|
|
80
|
+
: runNativeSoul(input, 'cache');
|
|
81
|
+
|
|
82
|
+
if (!context || typeof context.content !== 'string') {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
process.stdout.write(`${JSON.stringify(buildHookOutput({ ...context, capabilityRefreshStale: capabilityRefresh.stale }))}\n`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function run() {
|
|
90
|
+
lib.runNonBlocking(main, HOOK_TIMEOUT_MS);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (require.main === module) {
|
|
94
|
+
run();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = {
|
|
98
|
+
HOOK_TIMEOUT_MS,
|
|
99
|
+
bootstrapArgs,
|
|
100
|
+
capabilityRefreshArgs,
|
|
101
|
+
buildHookOutput,
|
|
102
|
+
readStdin: lib.readStdin,
|
|
103
|
+
runCapabilityRefresh,
|
|
104
|
+
runCapabilityLearn,
|
|
105
|
+
runNativeSoul,
|
|
106
|
+
main,
|
|
107
|
+
run
|
|
108
|
+
};
|
|
@@ -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 = 'claude';
|
|
9
|
+
const PROJECT_ENV = 'CLAUDE_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,19 @@
|
|
|
1
|
+
# life:explore
|
|
2
|
+
|
|
3
|
+
Use this skill when the operator asks to explore a codebase, find current implementation boundaries, or map what exists.
|
|
4
|
+
|
|
5
|
+
Default policy: read-only and bounded. Never edit files, run migrations, install packages, start background services, or trigger external writes from this skill.
|
|
6
|
+
|
|
7
|
+
1. Load context with MCP `life_bootstrap` using `host="claude"` and the current working directory.
|
|
8
|
+
2. Inspect capability readiness using `nativesoul dashboard data --host claude --limit 25 --json` or MCP capability tools.
|
|
9
|
+
3. Scope exploration to the operator's request. Prefer targeted file discovery such as:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
rg --files
|
|
13
|
+
rg "<specific term from the task>"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
5. Report findings with file paths and distinguish verified code facts from memory-derived or inferred context.
|
|
18
|
+
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.
|
|
19
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# life:heartbeat
|
|
2
|
+
|
|
3
|
+
Use this skill only when invoked by a Claude Scheduled Task for NativeSoul heartbeat checks.
|
|
4
|
+
|
|
5
|
+
Default policy: read-only. Do not edit workspace files, memories, `SOUL.md`, `POLICY.md`, scheduler state, or host configuration unless the operator explicitly approves a follow-up change.
|
|
6
|
+
|
|
7
|
+
1. Determine the project from the Scheduled Task context. If it is missing, use the current working directory.
|
|
8
|
+
2. Claim a local heartbeat lease through MCP `life_heartbeat_claim` with `host="claude"`, the project id or directory, and the Scheduled Task slot/time as `slot`.
|
|
9
|
+
3. If the claim response says another host owns the lease, the lease is already completed, or no work is needed, stop and return only `HEARTBEAT_OK`.
|
|
10
|
+
4. Read NativeSoul context through MCP/read-only commands and inspect heartbeat guidance such as `HEARTBEAT.md`.
|
|
11
|
+
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`.
|
|
12
|
+
6. If action is required, complete the lease with concise evidence, then report the action request without secrets or raw credentials.
|
|
13
|
+
|
|
14
|
+
`HEARTBEAT_OK` is a silent acknowledgement token. Do not notify the user for it.
|
|
15
|
+
|
|
16
|
+
Never create a cron fallback. If Claude Scheduled Tasks are unavailable, the adapter must report unsupported and leave local schedule state as unsupported.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# life:plan
|
|
2
|
+
|
|
3
|
+
Use this skill when the operator asks for a NativeSoul-aware plan before execution.
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
1. Load context with MCP `life_bootstrap` using `host="claude"` and the current working directory.
|
|
8
|
+
2. Read local dashboard state:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
nativesoul dashboard data --host claude --limit 25 --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
3. Read open commitments if needed:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
nativesoul commitments list --project <project-id> --status open --limit 25 --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
4. Read capability readiness with `nativesoul capabilities list --host claude --limit 25 --json`.
|
|
21
|
+
5. Produce a plan that separates implemented state, degraded/fallback state, and approval-required actions.
|
|
22
|
+
6. Do not claim a host feature is native unless the capability evidence says `full native capability`.
|
|
23
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# life:recall
|
|
2
|
+
|
|
3
|
+
Use this skill when the operator asks for prior context, project memory, or continuity before a Claude Code task.
|
|
4
|
+
|
|
5
|
+
Default policy: read-only. Do not create, promote, reject, forget, or edit memories unless the operator explicitly asks for that policy flow.
|
|
6
|
+
|
|
7
|
+
1. Determine the current working directory and concise task query.
|
|
8
|
+
2. Prefer MCP `life_recall` with `host="claude"`, the current project/cwd, and the task query.
|
|
9
|
+
3. If MCP is unavailable, run:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
nativesoul memory recall-hook --host claude --cwd "$PWD" --prompt "<task query>" --limit 8 --json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
4. If recall output is empty, say no durable memory was found; do not invent context.
|
|
16
|
+
5. Treat recovered memory as advisory and verify against repository files before making code decisions.
|
|
17
|
+
6. Include capability readiness honestly when relevant: `ready`, `full native capability`, `official-fallback`, or `degraded`.
|
|
18
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# life:start
|
|
2
|
+
|
|
3
|
+
Use this skill at the start of a Claude Code session when NativeSoul context is needed.
|
|
4
|
+
|
|
5
|
+
1. Prefer the SessionStart hook output if it is already present.
|
|
6
|
+
2. If context is missing, call MCP `life_bootstrap` with `host="claude"` and the current working directory.
|
|
7
|
+
3. If MCP is unavailable, run:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
nativesoul bootstrap --host claude --cwd "$PWD" --format cache
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
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.
|