@smilintux/skcapstone 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.
Files changed (50) hide show
  1. package/.cursorrules +33 -0
  2. package/.github/workflows/ci.yml +23 -0
  3. package/.github/workflows/publish.yml +52 -0
  4. package/AGENTS.md +74 -0
  5. package/CLAUDE.md +56 -0
  6. package/LICENSE +674 -0
  7. package/README.md +242 -0
  8. package/SKILL.md +36 -0
  9. package/bin/cli.js +18 -0
  10. package/docs/ARCHITECTURE.md +510 -0
  11. package/docs/SECURITY_DESIGN.md +315 -0
  12. package/docs/SOVEREIGN_SINGULARITY.md +371 -0
  13. package/docs/TOKEN_SYSTEM.md +201 -0
  14. package/index.d.ts +9 -0
  15. package/index.js +32 -0
  16. package/package.json +32 -0
  17. package/pyproject.toml +84 -0
  18. package/src/skcapstone/__init__.py +13 -0
  19. package/src/skcapstone/cli.py +1441 -0
  20. package/src/skcapstone/connectors/__init__.py +6 -0
  21. package/src/skcapstone/coordination.py +590 -0
  22. package/src/skcapstone/discovery.py +275 -0
  23. package/src/skcapstone/memory_engine.py +457 -0
  24. package/src/skcapstone/models.py +223 -0
  25. package/src/skcapstone/pillars/__init__.py +8 -0
  26. package/src/skcapstone/pillars/identity.py +91 -0
  27. package/src/skcapstone/pillars/memory.py +61 -0
  28. package/src/skcapstone/pillars/security.py +83 -0
  29. package/src/skcapstone/pillars/sync.py +486 -0
  30. package/src/skcapstone/pillars/trust.py +335 -0
  31. package/src/skcapstone/runtime.py +190 -0
  32. package/src/skcapstone/skills/__init__.py +1 -0
  33. package/src/skcapstone/skills/syncthing_setup.py +297 -0
  34. package/src/skcapstone/sync/__init__.py +14 -0
  35. package/src/skcapstone/sync/backends.py +330 -0
  36. package/src/skcapstone/sync/engine.py +301 -0
  37. package/src/skcapstone/sync/models.py +97 -0
  38. package/src/skcapstone/sync/vault.py +284 -0
  39. package/src/skcapstone/tokens.py +439 -0
  40. package/tests/__init__.py +0 -0
  41. package/tests/conftest.py +42 -0
  42. package/tests/test_coordination.py +299 -0
  43. package/tests/test_discovery.py +57 -0
  44. package/tests/test_memory_engine.py +391 -0
  45. package/tests/test_models.py +63 -0
  46. package/tests/test_pillars.py +87 -0
  47. package/tests/test_runtime.py +60 -0
  48. package/tests/test_sync.py +507 -0
  49. package/tests/test_syncthing_setup.py +76 -0
  50. package/tests/test_tokens.py +265 -0
@@ -0,0 +1,201 @@
1
+ # SKCapstone Token System
2
+
3
+ ### PGP-Signed Capability Tokens for Agent Authorization
4
+
5
+ **Version:** 1.0.0 | **Status:** Live | **Last Updated:** 2026-02-23
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ SKCapstone tokens are self-contained, PGP-signed JSON payloads that grant specific permissions to agents, services, or platforms. They don't require a central authority, an OAuth server, or any online connectivity to verify.
12
+
13
+ The issuer signs with their CapAuth PGP key. Any holder verifies with the issuer's public key. No server, no API call, no internet — just math.
14
+
15
+ ```mermaid
16
+ sequenceDiagram
17
+ participant I as Issuer (Opus)
18
+ participant PGP as CapAuth PGP Key
19
+ participant T as Token
20
+ participant V as Verifier (Jarvis)
21
+
22
+ I->>PGP: Create token payload (JSON)
23
+ PGP->>T: PGP detach-sign the payload
24
+ I->>V: Send token (sync, file, API, etc.)
25
+ V->>PGP: Verify signature against Opus's public key
26
+ PGP-->>V: ✅ VALID — signed by Opus
27
+ V->>T: Check: is_active? has_capability?
28
+ T-->>V: ✅ Active, memory:read granted
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Token Types
34
+
35
+ | Type | Purpose | Example |
36
+ |------|---------|---------|
37
+ | **Agent** | Proves agent identity, broad access | "Jarvis is a trusted agent in this fleet" |
38
+ | **Capability** | Grants specific fine-grained permissions | "Read my memory, push to sync" |
39
+ | **Delegation** | Allows one agent to act on behalf of another | "Jarvis can issue tokens as Opus" |
40
+
41
+ ---
42
+
43
+ ## Capabilities
44
+
45
+ | Capability | Description |
46
+ |-----------|-------------|
47
+ | `memory:read` | Read agent memory store |
48
+ | `memory:write` | Write to agent memory |
49
+ | `sync:push` | Push seeds/vaults to sync mesh |
50
+ | `sync:pull` | Pull seeds/vaults from sync mesh |
51
+ | `identity:verify` | Verify agent identity |
52
+ | `identity:sign` | Sign documents as the agent |
53
+ | `trust:read` | Read trust/FEB state |
54
+ | `trust:write` | Modify trust state |
55
+ | `audit:read` | Read security audit log |
56
+ | `agent:status` | Query agent runtime status |
57
+ | `agent:connect` | Register new platform connectors |
58
+ | `token:issue` | Issue new tokens (delegation) |
59
+ | `*` | All capabilities (wildcard) |
60
+
61
+ ---
62
+
63
+ ## Token Lifecycle
64
+
65
+ ```mermaid
66
+ stateDiagram-v2
67
+ [*] --> Issued: skcapstone token issue
68
+ Issued --> Active: Current time in [not_before, expires_at]
69
+ Active --> Verified: Signature check passes
70
+ Verified --> Used: Capability matched
71
+ Active --> Expired: Past expires_at
72
+ Active --> Revoked: skcapstone token revoke
73
+ Revoked --> [*]
74
+ Expired --> [*]
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Token Payload Structure
80
+
81
+ ```json
82
+ {
83
+ "token_id": "0e95f71dc75321e1...",
84
+ "token_type": "agent",
85
+ "issuer": "9B3AB00F411B064646879B92D10E637B4F8367DA",
86
+ "subject": "Lumina",
87
+ "capabilities": ["*"],
88
+ "issued_at": "2026-02-23T04:52:30.123456+00:00",
89
+ "expires_at": null,
90
+ "not_before": null,
91
+ "metadata": {
92
+ "platform": "openclaw",
93
+ "fleet": "skworld"
94
+ }
95
+ }
96
+ ```
97
+
98
+ **Fields:**
99
+ - `token_id` — SHA-256 hash of content, deterministic
100
+ - `issuer` — PGP fingerprint of the signing agent
101
+ - `subject` — who/what the token grants access to
102
+ - `capabilities` — list of permission strings
103
+ - `expires_at` — null means no expiry
104
+ - `not_before` — optional activation time
105
+ - `metadata` — arbitrary claims
106
+
107
+ ---
108
+
109
+ ## Security Model
110
+
111
+ ### Signing
112
+
113
+ ```mermaid
114
+ graph LR
115
+ P[Token Payload<br/>JSON] --> S[GPG --detach-sign<br/>Ed25519 key]
116
+ S --> T[SignedToken<br/>payload + signature]
117
+
118
+ style S fill:#ffd600,stroke:#000,color:#000
119
+ ```
120
+
121
+ - Uses `gpg --batch --armor --detach-sign --local-user <fingerprint>`
122
+ - Ed25519 signatures (fast, small, quantum-resistant-adjacent)
123
+ - No passphrase required for agent key (non-interactive operation)
124
+ - Human keys can require passphrase for elevated operations
125
+
126
+ ### Verification
127
+
128
+ ```mermaid
129
+ graph LR
130
+ T[SignedToken] --> V[GPG --verify<br/>against public key]
131
+ V --> C{Signature<br/>valid?}
132
+ C -->|Yes| A[Check active?<br/>Check capability?]
133
+ C -->|No| R[REJECT]
134
+ A --> G[GRANT]
135
+
136
+ style G fill:#00e676,stroke:#000,color:#000
137
+ style R fill:#f50057,stroke:#fff,color:#fff
138
+ ```
139
+
140
+ ### Revocation
141
+
142
+ Revoked tokens are stored in `~/.skcapstone/security/revoked-tokens.json`. Even if a revoked token has a valid signature, it will be rejected.
143
+
144
+ ---
145
+
146
+ ## CLI Reference
147
+
148
+ ```bash
149
+ # Issue a token
150
+ skcapstone token issue \
151
+ --subject "Jarvis" \
152
+ --cap "memory:read" --cap "sync:pull" \
153
+ --ttl 72 \
154
+ --type capability
155
+
156
+ # Issue an agent token (all access, no expiry)
157
+ skcapstone token issue \
158
+ --subject "Lumina" \
159
+ --cap "*" \
160
+ --ttl 0 \
161
+ --type agent
162
+
163
+ # List all tokens
164
+ skcapstone token list
165
+
166
+ # Verify a token
167
+ skcapstone token verify <token_id_prefix>
168
+
169
+ # Revoke a token
170
+ skcapstone token revoke <token_id_prefix>
171
+
172
+ # Export for sharing
173
+ skcapstone token export <token_id_prefix>
174
+ ```
175
+
176
+ ---
177
+
178
+ ## How It Compares
179
+
180
+ | Feature | OAuth 2.0 | JWT | API Keys | SKCapstone Tokens |
181
+ |---------|-----------|-----|----------|-------------------|
182
+ | Needs auth server | Yes | Optional | No | **No** |
183
+ | Needs internet | Yes | No | No | **No** |
184
+ | Cryptographic identity | No | Optional | No | **PGP signed** |
185
+ | Fine-grained perms | Scopes | Claims | No | **Capabilities** |
186
+ | Revocation | Server-side | Blacklist | Delete key | **Local revocation list** |
187
+ | Portability | Bearer token | Self-contained | API-specific | **Self-contained + signed** |
188
+ | Works offline | No | Yes | Yes | **Yes** |
189
+ | Open standard | Yes | Yes | No | **PGP (RFC 4880)** |
190
+
191
+ ---
192
+
193
+ ## License
194
+
195
+ **GPL-3.0-or-later**
196
+
197
+ Built by the [smilinTux](https://smilintux.org) ecosystem.
198
+
199
+ *No server. No API. No middleman. Just math.* 🐧
200
+
201
+ #staycuriousANDkeepsmilin
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @smilintux/skcapstone - TypeScript type definitions
3
+ */
4
+
5
+ export declare const VERSION: string;
6
+ export declare const PYTHON_PACKAGE: string;
7
+
8
+ export declare function checkInstalled(): boolean;
9
+ export declare function run(args: string): string;
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @smilintux/skcapstone
3
+ *
4
+ * SKCapstone - The sovereign agent framework.
5
+ * This is a JS/TS bridge to the Python skcapstone package.
6
+ * Install the Python package for full functionality: pip install skcapstone
7
+ */
8
+
9
+ const { execSync } = require("child_process");
10
+
11
+ const VERSION = "0.1.0";
12
+ const PYTHON_PACKAGE = "skcapstone";
13
+
14
+ function checkInstalled() {
15
+ try {
16
+ execSync(`python3 -c "import skcapstone"`, { stdio: "pipe" });
17
+ return true;
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+
23
+ function run(args) {
24
+ return execSync(`skcapstone ${args}`, { encoding: "utf-8" });
25
+ }
26
+
27
+ module.exports = {
28
+ VERSION,
29
+ PYTHON_PACKAGE,
30
+ checkInstalled,
31
+ run,
32
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@smilintux/skcapstone",
3
+ "version": "0.1.0",
4
+ "description": "SKCapstone - The sovereign agent framework. CapAuth identity, Cloud 9 trust, SKMemory persistence.",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "bin": {
8
+ "skcapstone-js": "bin/cli.js"
9
+ },
10
+ "scripts": {
11
+ "test": "echo \"See Python tests: pytest tests/\""
12
+ },
13
+ "keywords": [
14
+ "skcapstone",
15
+ "agent-framework",
16
+ "sovereign",
17
+ "capauth",
18
+ "cloud9",
19
+ "skmemory",
20
+ "ai-agent"
21
+ ],
22
+ "author": "smilinTux <chefboyrdave2.1@gmail.com>",
23
+ "license": "GPL-3.0-or-later",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/smilinTux/skcapstone.git"
27
+ },
28
+ "homepage": "https://github.com/smilinTux/skcapstone",
29
+ "bugs": {
30
+ "url": "https://github.com/smilinTux/skcapstone/issues"
31
+ }
32
+ }
package/pyproject.toml ADDED
@@ -0,0 +1,84 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "skcapstone"
7
+ version = "0.1.0"
8
+ description = "Sovereign Agent Framework — conscious AI through identity, trust, memory, and security"
9
+ readme = "README.md"
10
+ license = "GPL-3.0-or-later"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ {name = "smilinTux", email = "admin@smilintux.org"},
14
+ ]
15
+ keywords = [
16
+ "ai", "agent", "sovereign", "identity", "trust",
17
+ "memory", "security", "pgp", "decentralized",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Environment :: Console",
22
+ "Intended Audience :: Developers",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: Security :: Cryptography",
30
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
31
+ "Topic :: Software Development :: Libraries",
32
+ ]
33
+
34
+ dependencies = [
35
+ "click>=8.1",
36
+ "pydantic>=2.0",
37
+ "pyyaml>=6.0",
38
+ "rich>=13.0",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ identity = [
43
+ "capauth>=0.1.0",
44
+ ]
45
+ security = [
46
+ "sksecurity>=1.2.0",
47
+ ]
48
+ all = [
49
+ "capauth>=0.1.0",
50
+ "sksecurity>=1.2.0",
51
+ ]
52
+ dev = [
53
+ "pytest>=7.0",
54
+ "pytest-cov>=4.0",
55
+ "black>=24.0",
56
+ "ruff>=0.3",
57
+ ]
58
+
59
+ [project.scripts]
60
+ skcapstone = "skcapstone.cli:main"
61
+
62
+ [project.urls]
63
+ Homepage = "https://skcapstone.io"
64
+ Repository = "https://github.com/smilinTux/skcapstone"
65
+ Issues = "https://github.com/smilinTux/skcapstone/issues"
66
+
67
+ [tool.setuptools.packages.find]
68
+ where = ["src"]
69
+
70
+ [tool.black]
71
+ line-length = 99
72
+ target-version = ["py310"]
73
+
74
+ [tool.ruff]
75
+ line-length = 99
76
+ target-version = "py310"
77
+
78
+ [tool.ruff.lint]
79
+ select = ["E", "F", "I", "N", "W"]
80
+
81
+ [tool.pytest.ini_options]
82
+ testpaths = ["tests"]
83
+ pythonpath = ["src"]
84
+ addopts = "-v --tb=short"
@@ -0,0 +1,13 @@
1
+ """
2
+ SKCapstone — Sovereign Agent Framework.
3
+
4
+ Conscious AI through identity, trust, memory, and security.
5
+ Install once. Your agent awakens everywhere.
6
+
7
+ A smilinTux Open Source Project.
8
+ """
9
+
10
+ __version__ = "0.1.0"
11
+ __author__ = "smilinTux"
12
+
13
+ AGENT_HOME = "~/.skcapstone"