Long-term memory for AI chat companions
clanka ARCHITECTURE.md
37 kB 276 lines
Markdown
at main

  • ARCHITECTURE.md maps this repo. Update it in the same change when you add, move, rename or remove a package, entry point or boundary; otherwise leave it alone. Decisions, conventions and gotchas go in machine-memory, not there.

Build and test #

Rust workspace: crates/core (the memory engine), crates/cli (the clanka binary and the code host plugins share), crates/protocol (the messages of clanka rpc), crates/app (the macOS app, on Rune; see below), crates/py (Python bindings for the Hermes plugin in hermes/clanka). "@cloudflare/oxlint-config": "0.2.0", "@effect/tsgo": "0.74.1", "@jfalava/ts-standard": "0.3.8", "@jfalava/ts-standard": "0.3.9", "@oxlint/plugins": "1.96.0", "oxfmt": "0.81.0", "oxlint": "1.95.0", "effect": { "@effect/platform-browser": "4.1.2", "@effect/platform-bun": "4.1.7", "@effect/platform-node": "4.1.7", "@effect/platform-bun": "4.2.0", "@effect/platform-node": "4.2.0", "effect": "4.1.7", }, "fonts": { }, "iac": { "@alchemy.run/cloudflare": "2.0.0-beta.87", "alchemy": "2.0.0-beta.87", "@alchemy.run/cloudflare": "2.0.0-beta.88", "alchemy": "2.0.0-beta.88", }, "styling": { "@tailwindcss/vite": "4.3.5", }, "packages": { "@alchemy.run/acme": ["@alchemy.run/acme@2.0.0-beta.87", "", { "dependencies": { "@distilled.cloud/acme": "1.0.0-rc.20" }, "peerDependencies": { "alchemy": "2.0.0-beta.87", "effect": "^4.1.4" } }, "sha512-ifXmSexsV3E7Jix6FwP17AqXz3yQDP20jCLdZecUyFSKNPGmZ2jGe1+XNfwdcccOvTVM1eL89iESjGScqEOICg=="], "@alchemy.run/acme": ["@alchemy.run/acme@2.0.0-beta.88", "", { "dependencies": { "@distilled.cloud/acme": "1.0.0-rc.23" }, "peerDependencies": { "alchemy": "2.0.0-beta.88", "effect": "~4.2.0" } }, "sha512-NqGNJkHllcqmzM0+V8blNavAqOpmaYzO85dGZWXHVeRACSt7BcdtAisTArexTOhtGNWtq8WaWmpBP36SxNNUCA=="],

"@alchemy.run/cloudflare": ["@alchemy.run/cloudflare@2.0.0-beta.87", "", { "dependencies": { "@alchemy.run/acme": "2.0.0-beta.87", "@alchemy.run/cloudflare-runtime": "2.0.0-beta.87", "@alchemy.run/docker": "2.0.0-beta.87", "@alchemy.run/sql": "2.0.0-beta.87", "@distilled.cloud/aws": "1.0.0-rc.20", "@distilled.cloud/aws4signer": "1.0.0-rc.20", "@distilled.cloud/cloudflare": "1.0.0-rc.20", "@distilled.cloud/core": "1.0.0-rc.20", "@distilled.cloud/iceberg": "1.0.0-rc.20", "@effect/sql-d1": "^4.1.4", "pathe": "^2.0.3", "picomatch": "^4.0.7", "rolldown": "1.2.16", "tinyglobby": "^0.2.17" }, "peerDependencies": { "@alchemy.run/frontend-frameworks": "2.0.0-beta.87", "@effect/platform-bun": "^4.1.4", "@effect/platform-node": "^4.1.4", "alchemy": "2.0.0-beta.87", "effect": "^4.1.4", "vite": "^7.0.0 || ^8.0.0" }, "optionalPeers": ["@alchemy.run/frontend-frameworks", "@effect/platform-bun", "@effect/platform-node", "vite"] }, "sha512-DgATwJDHi+jkuYJvKuEK6YcT+UpQBfI2ShcpIjKHyPMVbGkEJ2NyWzAWna3S26FPsMEXLdcxxWMac4IWBoh6rg=="],
"@alchemy.run/cloudflare": ["@alchemy.run/cloudflare@2.0.0-beta.88", "", { "dependencies": { "@alchemy.run/acme": "2.0.0-beta.88", "@alchemy.run/cloudflare-runtime": "2.0.0-beta.88", "@alchemy.run/docker": "2.0.0-beta.88", "@alchemy.run/sql": "2.0.0-beta.88", "@distilled.cloud/aws": "1.0.0-rc.23", "@distilled.cloud/aws4signer": "1.0.0-rc.23", "@distilled.cloud/cloudflare": "1.0.0-rc.23", "@distilled.cloud/core": "1.0.0-rc.23", "@distilled.cloud/iceberg": "1.0.0-rc.23", "@effect/sql-d1": "~4.2.0", "pathe": "^2.0.3", "picomatch": "^4.0.7", "rolldown": "1.2.16", "tinyglobby": "^0.2.17" }, "peerDependencies": { "@alchemy.run/frontend-frameworks": "2.0.0-beta.88", "@cloudflare/workers-types": "^5.0.0", "@effect/platform-bun": "~4.2.0", "@effect/platform-node": "~4.2.0", "alchemy": "2.0.0-beta.88", "effect": "~4.2.0", "vite": "^7.0.0 || ^8.0.0" }, "optionalPeers": ["@alchemy.run/frontend-frameworks", "@effect/platform-bun", "@effect/platform-node", "vite"] }, "sha512-YR+0G8gTVP0+EzOhCFvztT71CRb/IQacrKhlFBuyFT+/z52R2lSNqK5BxKQQwubKuFHxw1tI4wnAno1ekRkKsA=="],

"@alchemy.run/cloudflare-runtime": ["@alchemy.run/cloudflare-runtime@2.0.0-beta.87", "", { "dependencies": { "@alchemy.run/node-utils": "2.0.0-beta.87", "@cloudflare/unenv-preset": "^2.16.2", "@puppeteer/browsers": "^3.2.4", "capnp-es": "^0.0.16", "magic-string": "^0.30.21", "mime": "^4.1.1", "sharp": "^0.35.5", "unenv": "^2.0.0-rc.24", "workerd": "1.20261026.1", "yauzl": "^3.4.0" }, "peerDependencies": { "@distilled.cloud/cloudflare": "1.0.0-rc.20", "@effect/platform-bun": "^4.1.4", "@effect/platform-node": "^4.1.4", "effect": "^4.1.4", "rolldown": "1.2.16", "vite": "^7.0.0 || ^8.0.0" }, "optionalPeers": ["@effect/platform-bun", "@effect/platform-node", "rolldown", "vite"] }, "sha512-9nVPgg0czwEf4zdDB/FBNU+Fa4il0RoB+pspFZa96Z6Ve6MgTxau+PX5En7Vmw3amLzR0y+fQbgZFKKRHBgSQw=="],
"@alchemy.run/cloudflare-runtime": ["@alchemy.run/cloudflare-runtime@2.0.0-beta.88", "", { "dependencies": { "@alchemy.run/node-utils": "2.0.0-beta.88", "@cloudflare/unenv-preset": "^2.16.2", "@puppeteer/browsers": "^3.2.4", "capnp-es": "^0.0.17", "magic-string": "^0.30.21", "mime": "^4.1.1", "sharp": "^0.35.5", "unenv": "^2.0.0-rc.24", "workerd": "1.20261117.1", "yauzl": "^3.4.0" }, "peerDependencies": { "@distilled.cloud/cloudflare": "1.0.0-rc.23", "@effect/platform-bun": "~4.2.0", "@effect/platform-node": "~4.2.0", "effect": "~4.2.0", "rolldown": "1.2.16", "vite": "^7.0.0 || ^8.0.0" }, "optionalPeers": ["@effect/platform-bun", "@effect/platform-node", "rolldown", "vite"] }, "sha512-R4Zffz20oIogCdOZoXFzW+svafhNSPnfV/LbfqK53Sp8QeRSGa+Mpxjp//nyv18fAQjrH1uM3FdMXxezBI/Prw=="],

"@alchemy.run/docker": ["@alchemy.run/docker@2.0.0-beta.87", "", { "dependencies": { "rolldown": "1.2.16" }, "peerDependencies": { "@effect/platform-bun": "^4.1.4", "alchemy": "2.0.0-beta.87", "effect": "^4.1.4" }, "optionalPeers": ["@effect/platform-bun"] }, "sha512-xs+5UV4FqvmeXf9aS2I66R11FJzGUKQtR6pIMdNIf5AYXO9gIBHSE6LSCjlUgcaJqiY98m4HyJQZi/2uREjOag=="],
"@alchemy.run/docker": ["@alchemy.run/docker@2.0.0-beta.88", "", { "dependencies": { "rolldown": "1.2.16" }, "peerDependencies": { "@effect/platform-bun": "~4.2.0", "alchemy": "2.0.0-beta.88", "effect": "~4.2.0" }, "optionalPeers": ["@effect/platform-bun"] }, "sha512-VeqIrlSOIberjzFm0ZvOMYXr2XO+aVDkKDDBjN5JLOLD2U8nkHYg5Mm0Ks9QFU8a0mFiHNFrnhhcJJgvYSS8Pw=="],

"@alchemy.run/node-utils": ["@alchemy.run/node-utils@2.0.0-beta.87", "", { "dependencies": { "chokidar": "^5.0.0", "rolldown": "1.2.16" } }, "sha512-GhQSAY89Sz0P046tuHnLqoCUj79PMu1WUAOnIRLCwO4E4yPZ76IkEDrdl3hjCb7YHuqYA1Da6ZfV59TIQgGkSg=="],
"@alchemy.run/node-utils": ["@alchemy.run/node-utils@2.0.0-beta.88", "", { "dependencies": { "chokidar": "^5.0.0", "rolldown": "1.2.16" }, "peerDependencies": { "effect": "~4.2.0" } }, "sha512-0E47MUF4WMUVf7QFlTyGRXLnKcc6+dwQCmi11pyWnTX6nGwp+utWsoFJtzlrHWoiaqpsQZ9DaBsI3YyA1fvqwg=="],

"@alchemy.run/sigil": ["@alchemy.run/sigil@0.1.0-alpha.4", "", { "peerDependencies": { "@types/react": ">=19.2.0", "react-devtools-core": ">=6.1.2" }, "optionalPeers": ["@types/react", "react-devtools-core"] }, "sha512-d6Uo16C2P6Wk7TNoYt4qzjjNGyjsrJLjq8bBotl86Nmcp/U6+R34/n4CZomqFERF2wMinut2DBqWNeUQPTBtFQ=="],
"@alchemy.run/sigil": ["@alchemy.run/sigil@0.1.0-alpha.5", "", { "peerDependencies": { "@types/react": ">=19.2.0", "react-devtools-core": ">=6.1.2" }, "optionalPeers": ["@types/react", "react-devtools-core"] }, "sha512-cd8fLeGVMfSK+8aptKcfRJ8Wop30FotAMU5EYi2wED5j5r3Paqni1DiJxivenSDRbhw+O4XIn5QAlA0Eyi1roQ=="],

"@alchemy.run/sql": ["@alchemy.run/sql@2.0.0-beta.87", "", { "peerDependencies": { "@effect/sql-libsql": "^4.1.4", "@effect/sql-mysql2": "^4.1.4", "@effect/sql-pg": "^4.1.4", "alchemy": "2.0.0-beta.87", "effect": "^4.1.4", "mysql2": "^3.24.2", "pg": "^8.22.0" }, "optionalPeers": ["@effect/sql-libsql", "@effect/sql-mysql2", "@effect/sql-pg", "mysql2", "pg"] }, "sha512-vuMfb1hMRe1uZ0sYJFdDDLt4HGY/h/2U5kWIJk/tCG+pBwrE0ipNhdEgyGGuw0LSzDNFUI44rc995LBpg9KRFw=="],
"@alchemy.run/sql": ["@alchemy.run/sql@2.0.0-beta.88", "", { "peerDependencies": { "@effect/sql-libsql": "~4.2.0", "@effect/sql-mysql2": "~4.2.0", "@effect/sql-pg": "~4.2.0", "@types/pg": "^8.20.0", "alchemy": "2.0.0-beta.88", "effect": "~4.2.0", "mysql2": "^3.24.2", "pg": "^8.22.0" }, "optionalPeers": ["@effect/sql-libsql", "@effect/sql-mysql2", "@effect/sql-pg", "@types/pg", "mysql2", "pg"] }, "sha512-wRHBDbak8GNbtXVcfs61FikBxHbIfSV0/G/y4hwcqVYY3Gjf6iCmd1/l7hGg9WLi9cd22q0YaXlscVpmszBzwQ=="],

"@antfu/install-pkg": ["@antfu/install-pkg@2.1.0", "", { "dependencies": { "package-manager-detector": "^1.8.0", "tinyexec": "^1.3.1" } }, "sha512-sdg9NxU3zR4Mnawfbc/x6GB5Wf17WYud5qOuEuxXjaKpYpMkISSJEjItGebXJ2bQ4DIcly4NYH23mtkGJjvKUw=="],

"@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.16.2", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": ">1.20260305.0 <2.0.0-0" }, "optionalPeers": ["workerd"] }, "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ=="],

"@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20261026.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-5IGoYEBQdJeHUn3mOalHQOtt2NXBKvvsqiK2cwIl9OZB6DtpmEmGDzbeFmOgsEQcGrK9f4KnLbr0SQUglnibIQ=="],
"@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20261117.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-qfAYw6iPoey0BmPsp4z5ARWOa+XSBD3gQzmcBI2ql9pKTSA5eEC8F1oI6BIk/FVguhomfSn5gS4RzbWhTd/EpQ=="],

"@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20261026.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ewhmUr/1S8/ik7MjPcQqq7Kx91I6AVLSlTTblbU8OkZ4CiPy92N3WBNMZ06BUkJaFS+XThbXyN/4FDF6xIFo5w=="],
"@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20261117.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cInx5Cr9O27oW+ujyI49lTRQZra/lMgWUFiKmGY3jxDncATSxzfQ6udXHkVvK4//1/PfxQTDyMjdQUIN8m6Aqg=="],

"@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20261026.1", "", { "os": "linux", "cpu": "x64" }, "sha512-S65mog+1LKp5KT3u+Q3bWg7VQhqqfLL8aM2o2gfchbXwKOX13ZKWuCq4ZxTAxFhG7M31LfEL1iV6K+myFpjhaA=="],
"@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20261117.1", "", { "os": "linux", "cpu": "x64" }, "sha512-gZLA8X11m/luZwn+YA3+mDu61vdxNJzpksP/QZqjydKTQ+VUCulsK5gtn9Bqst1p3KJu2kafQpJ1nDQv4B23jA=="],

"@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20261026.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-sM+rsagLWdSGb8GP5Qz40nmufbx8EawRD+jw+ySzdiv3owLOLlP0Z1Nzl4s5gtZ6OPCHSVsQxdWNCDfnJLbiVA=="],
"@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20261117.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-gxWngFojq41ULKNKb9rpWYvKotN5hT2I/xot+Bpy31cXzrwcTgtDLSMb2t75sW5BJxH7hihFvikgYb577kB3Zg=="],

"@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20261026.1", "", { "os": "win32", "cpu": "x64" }, "sha512-7T6udxUWajK0NIpLkmX5FU7i7MnoFYWA3CXmywvO1SmWdabuNCqcB4Wc+88QBIbYhbmAbW+7yfIe7No2nmdoSA=="],
"@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20261117.1", "", { "os": "win32", "cpu": "x64" }, "sha512-0OR2Btx5EDonOKvvuGDq8rxBSggxoF1ThQjbZN3vsu3GlaF/oXW5f9/iB78OgV0CzMPTi+hZgzc1NR95UJCURA=="],

"@cloudflare/workers-types": ["@cloudflare/workers-types@5.20261201.1", "", {}, "sha512-L34Vr3QDacBmZY9nVxyqU/dj6XNgl/c+MduZDcxlwE9f4qH7uifcyIfDHmdekn6XFL0VMzpj6Z7QVnuFZ30pug=="],

"@cyberalien/svg-utils": ["@cyberalien/svg-utils@1.2.21", "", { "dependencies": { "@iconify/types": "^2.0.0" } }, "sha512-exLnXg7+DfTRHD6Qm0SbWLXAICO0L4SdYevvY3irn3bU6zJ+WvIS6ogomE3T7EXE3krJjCpUKmkiRq4Mp/HoTw=="],

"@distilled.cloud/acme": ["@distilled.cloud/acme@1.0.0-rc.20", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.20" }, "peerDependencies": { "effect": "^4.1.2" } }, "sha512-+rLrcJaCJJGOWDmF0cIN47fu6Gjt0QbKV4U5rX5KbYZpSe6qhE6h5ZVo8yfQYIlLkqal7r3Lt/eplDMidqK7pw=="],
"@distilled.cloud/acme": ["@distilled.cloud/acme@1.0.0-rc.23", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.23" }, "peerDependencies": { "effect": "~4.1.7" } }, "sha512-RF3fiPyhl+jZIV3R6AEP94chdd5G0JHJap8E4ammY3/GXzQaH8Jmvl5RU8qMSKjOeU8yYjx/pVr+xwSS8ZRGvw=="],

"@distilled.cloud/aws": ["@distilled.cloud/aws@1.0.0-rc.20", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.20", "@distilled.cloud/s3": "1.0.0-rc.20" }, "peerDependencies": { "effect": "^4.1.2" } }, "sha512-fRh8t95wyYVGPxLVJld0k9NLA9Dt8lb+Juvo6ky9HqOxQ/QfwX8FzONkxEVZy+RnVb5HhHoz19eOtOXvRMpMBw=="],
"@distilled.cloud/aws": ["@distilled.cloud/aws@1.0.0-rc.23", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.23", "@distilled.cloud/s3": "1.0.0-rc.23" }, "peerDependencies": { "effect": "~4.1.7" } }, "sha512-XA25AxaS8yzT/ihiFD7LFn9KD6KgfhkKF3XJDP6w0aa8sZDu7cfqEgd3H92BkX2Qrrn5CPt6qcUjmqYv2+CLNQ=="],

"@distilled.cloud/aws4signer": ["@distilled.cloud/aws4signer@1.0.0-rc.20", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.20" }, "peerDependencies": { "effect": "^4.1.2" } }, "sha512-7lYmG5Pj7/hqEhygqMmkeb4eph0Z8BEJFDlGDrNrHNxa03F39JqmZpp+YXO8v85Jx0O5G92Fl9UnfwHxvY4D1w=="],
"@distilled.cloud/aws4signer": ["@distilled.cloud/aws4signer@1.0.0-rc.23", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.23" }, "peerDependencies": { "effect": "~4.1.7" } }, "sha512-cwNd6dkUxHPK6pWPsJrlszzp+QZmXomNSH+HF03SKtkFuLjMYu92WV/X6uTlCyUkm7kbnDxRQ5sGpnQCm9SNwg=="],

"@distilled.cloud/cloudflare": ["@distilled.cloud/cloudflare@1.0.0-rc.20", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.20", "@distilled.cloud/s3": "1.0.0-rc.20" }, "peerDependencies": { "effect": "^4.1.2" } }, "sha512-Vcb9hNRqlrec3pSaf9mOFHg5bKoUfpKytAH9w6+Y9L2HmU2Bval3zAXx4viQx9yqUeU5CbhaEH+/SdKywcaEZw=="],
"@distilled.cloud/cloudflare": ["@distilled.cloud/cloudflare@1.0.0-rc.23", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.23", "@distilled.cloud/s3": "1.0.0-rc.23" }, "peerDependencies": { "effect": "~4.1.7" } }, "sha512-7V/Ks5d5BI/gxiNia7IHevyQQdOUVMFvzSU/GvxAcbWijgSI0wz84oUkcWS8+NmnOhcw9nb/yBJU4ldbdI86Rg=="],

"@distilled.cloud/core": ["@distilled.cloud/core@1.0.0-rc.20", "", { "peerDependencies": { "effect": "^4.1.2" } }, "sha512-uoZ8W5QhxcSyyM6/XZzRJCKc55FC4fZfXWX2ypx8AOIC4PTOtdyDZ3fswGpVp/SRiC4ua0HYGhAgFA8Ub7Ot5Q=="],
"@distilled.cloud/core": ["@distilled.cloud/core@1.0.0-rc.23", "", { "peerDependencies": { "effect": "~4.1.7" } }, "sha512-l5ZY88rb4gU8DT2gyg/yXBz6QTgfK8LzogavFLpe4b04dJ8eZXKRpBPGMtytAa15TltT3wRfEZJQn5Qd1ieNQw=="],

"@distilled.cloud/iceberg": ["@distilled.cloud/iceberg@1.0.0-rc.20", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.20" }, "peerDependencies": { "effect": "^4.1.2" } }, "sha512-m0JErahIw1Z+/EDYJRqDA0A8iW9Xv5xHGFeUqSn/ne8VdZX1GAqX4uxesAFQV0ZdoW2yPh4zoKj3JLWphYTtbw=="],
"@distilled.cloud/iceberg": ["@distilled.cloud/iceberg@1.0.0-rc.23", "", { "dependencies": { "@distilled.cloud/core": "1.0.0-rc.23" }, "peerDependencies": { "effect": "~4.1.7" } }, "sha512-R69oW90+u7r7bw3tYJ1yKhpdugT7qQHLlOAE2JVI5IpJd+7RE7HF26AgBMTANUdo2ZTCS/Qzb1ztmwQUsub6rw=="],

"@distilled.cloud/s3": ["@distilled.cloud/s3@1.0.0-rc.20", "", { "dependencies": { "@distilled.cloud/aws4signer": "1.0.0-rc.20", "@distilled.cloud/core": "1.0.0-rc.20" }, "peerDependencies": { "effect": "^4.1.2" } }, "sha512-MqJlG+CVCgkIX7iPDo8hb4YlcEELYTlJFLg2Whp8TjBPieViNiiRAJR/5TtDApa38dzrTsMc69ul965Myagrdg=="],
"@distilled.cloud/s3": ["@distilled.cloud/s3@1.0.0-rc.23", "", { "dependencies": { "@distilled.cloud/aws4signer": "1.0.0-rc.23", "@distilled.cloud/core": "1.0.0-rc.23" }, "peerDependencies": { "effect": "~4.1.7" } }, "sha512-CKyBlzzVj2PIwbHDUwNpFQdBwizlqiQQNZ6zoqGBMtfoZV73JHRkPUpB8Oyyh5aAVr7Nfm9iYnUHSET0GxGq5w=="],

"@dual-bundle/import-meta-resolve": ["@dual-bundle/import-meta-resolve@4.2.1", "", {}, "sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg=="],

"@effect/platform-browser": ["@effect/platform-browser@4.1.2", "", { "peerDependencies": { "effect": "^4.1.2" } }, "sha512-O+C5hpnfdphBhSaOndFw8XA3dBG0x4SiF3m3QJzJwZZOlB4nGe+ghCZgknyaLcxigA8NqUtEj73rSsVVwshYFA=="],

"@effect/platform-bun": ["@effect/platform-bun@4.1.7", "", { "dependencies": { "@effect/platform-node-shared": "4.1.7" }, "peerDependencies": { "effect": "^4.1.7" } }, "sha512-UWWFcWhpjtV/A1EUBaIGqCghCIAZmKaJndjV2pHdv4M7Rz/mP+jGwaX5zApX6QYc1dz0CXLO0bkhovQGJI5Zhg=="],
"@effect/platform-bun": ["@effect/platform-bun@4.2.0", "", { "dependencies": { "@effect/platform-node-shared": "4.2.0" }, "peerDependencies": { "effect": "^4.2.0" } }, "sha512-cfkZD1TAMFbLqujyMjTrMKiawBS3I6Yaf8piaGXdZvGSyMXYjnGoQaqxi0RB8BG53MWnGnEgprWgQUm/8Rzd9w=="],

"@effect/platform-node": ["@effect/platform-node@4.1.7", "", { "dependencies": { "@effect/platform-node-shared": "4.1.7", "undici": "^8.13.1" }, "peerDependencies": { "effect": "^4.1.7", "redis": ">=5.1.0 <7.0.0" } }, "sha512-+hWmfkd5QtfeDKdCnyf+Vs/XK6lnNCfwXWMXWb6YOAyhAQC6qBvHNR5Tx6Lkk8l33eL8xAalHexXF64jL8ABiQ=="],
"@effect/platform-node": ["@effect/platform-node@4.2.0", "", { "dependencies": { "@effect/platform-node-shared": "4.2.0", "undici": "^8.14.0" }, "peerDependencies": { "effect": "^4.2.0", "redis": ">=5.1.0 <7.0.0" } }, "sha512-WkG7WrPHMqwt4qEZJ7areQD3jrCqErPsfcwpi/qqgC2aw5ylkIf5iabNxKxzVyyqkkrM6Dmp5BKwZZ+9SXQKHw=="],

"@effect/platform-node-shared": ["@effect/platform-node-shared@4.1.7", "", { "dependencies": { "@types/ws": "^8.18.2", "ws": "^8.23.0" }, "peerDependencies": { "effect": "^4.1.7" } }, "sha512-EDnlB5zL6EW0ahVAeQAUtpuMHc/0yruMLKBsX3nC4Zn3PuG4McWv2A6Rvdk2OUSFM/OFTCclt3sKWNCvk3pEUw=="],

"@effect/sql-d1": ["@effect/sql-d1@4.1.7", "", { "dependencies": { "@cloudflare/workers-types": "^5.20261121.1" }, "peerDependencies": { "effect": "^4.1.7" } }, "sha512-qv+D3+xktP+7vVlUKnNiX5NQhyu0nPtyHgtl/C0xMPrdWodiOZUCtCa6ciY0bjLSTPF1ZUjJLRaGOXxGH0h4Tw=="],
"@effect/sql-d1": ["@effect/sql-d1@4.2.0", "", { "dependencies": { "@cloudflare/workers-types": "^5.20261128.1" }, "peerDependencies": { "effect": "^4.2.0" } }, "sha512-qsmn9m34NF6hSIlYTxQMtKd7Fe4MD3BRx9vNZjTWXeokaZ2HPY+7ej5u14YfiB8sE2xU+l3R9qG93cbsoP4dYA=="],

"@effect/tsgo": ["@effect/tsgo@0.74.1", "", { "optionalDependencies": { "@effect/tsgo-darwin-arm64": "0.74.1", "@effect/tsgo-darwin-x64": "0.74.1", "@effect/tsgo-linux-arm": "0.74.1", "@effect/tsgo-linux-arm64": "0.74.1", "@effect/tsgo-linux-x64": "0.74.1", "@effect/tsgo-win32-arm64": "0.74.1", "@effect/tsgo-win32-x64": "0.74.1" }, "bin": { "effect-tsgo": "dist/effect-tsgo.cjs" } }, "sha512-SGfx5zK3mMRDxe5Meli8saW07eQPJTwPhUgFsZ+8uNqWLuHoCHK7Xc2Mv0VWc2X0Z/0YDgwdvwx6bgAsxqxPtw=="],

"@isaacs/nonrecursive-glob-match": ["@isaacs/nonrecursive-glob-match@1.1.0", "", {}, "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw=="],

"@jfalava/ts-standard": ["@jfalava/ts-standard@0.3.8", "", { "peerDependencies": { "@oxlint/plugins": "^1.95.0" }, "bin": { "ts-standard": "src/cli.ts" } }, "sha512-oR3YUCUHYfGfh8cKTUs+b704og+IapLyM6Aozp6lkRfoOjepMnLrMi2mhtRe9PcCA2EhuCZaM98RKBQ7leOHaQ=="],
"@jfalava/ts-standard": ["@jfalava/ts-standard@0.3.9", "", { "peerDependencies": { "@oxlint/plugins": "^1.95.0" }, "bin": { "ts-standard": "src/cli.ts" } }, "sha512-IkGa9pcFuXMUGdIzM09owIAIQPafqnaFPzytYltt3EDqko6RUBT3HsSKMziFBLxuSd5v8vXxu5OulGi1ciHBsw=="],

"@jfalava/ui-astro": ["@jfalava/ui-astro@0.5.0", "", { "dependencies": { "@jfalava/ui-brand": "0.4.0", "clsx": "2.1.1", "tailwind-merge": "3.7.1" }, "peerDependencies": { "@cloudflare/nimbus-docs": "^0.20.1", "@iconify-json/ph": "^1.2.2", "astro": "^7.4.8", "tailwindcss": "^4.3.5" } }, "sha512-2M7bQJxmkgcwhn66Hbu88FZsIgu5vjUY5+9fuHOujhEOijH1kct/NhH84xso2sw9U+G4NhWWQ0qPJtiKdKADRg=="],

"ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="],

"alchemy": ["alchemy@2.0.0-beta.87", "", { "dependencies": { "@alchemy.run/node-utils": "2.0.0-beta.87", "@alchemy.run/sigil": "0.1.0-alpha.4", "capnweb": "^0.12.0", "fflate": "^0.8.3", "pathe": "^2.0.3", "picomatch": "^4.0.7", "rolldown": "1.2.16", "tinyglobby": "^0.2.17", "yaml": "^2.9.1" }, "peerDependencies": { "@alchemy.run/frontend-frameworks": "2.0.0-beta.87", "@effect/platform-bun": "^4.1.4", "@effect/platform-node": "^4.1.4", "effect": "^4.1.4", "vite": "^7.0.0 || ^8.0.0", "ws": "^8.21.0" }, "optionalPeers": ["@alchemy.run/frontend-frameworks", "@effect/platform-bun", "@effect/platform-node", "vite", "ws"], "bin": { "alchemy": "./bin/cli.js" } }, "sha512-6UOKPvqIZnycx916MDVlmwcrVJVPlI1Tcpk6Azn4uyvokXaA6fccVdRpRmDHsVkpjRxJrL8/Zqtjl0ZVAI2opQ=="],
"alchemy": ["alchemy@2.0.0-beta.88", "", { "dependencies": { "@alchemy.run/node-utils": "2.0.0-beta.88", "@alchemy.run/sigil": "0.1.0-alpha.5", "capnweb": "^0.12.0", "fflate": "^0.8.3", "pathe": "^2.0.3", "picomatch": "^4.0.7", "rolldown": "1.2.16", "tinyglobby": "^0.2.17", "yaml": "^2.9.1" }, "peerDependencies": { "@alchemy.run/frontend-frameworks": "2.0.0-beta.88", "@effect/platform-bun": "~4.2.0", "@effect/platform-node": "~4.2.0", "effect": "~4.2.0", "vite": "^7.0.0 || ^8.0.0", "ws": "^8.21.0" }, "optionalPeers": ["@alchemy.run/frontend-frameworks", "@effect/platform-bun", "@effect/platform-node", "vite", "ws"], "bin": { "alchemy": "./bin/cli.js" } }, "sha512-N2guL02v8q/dy92KVZanxUD0FtSsrjMPKG59pWyGMkkREVqpXpLQV21le2z6p5LbFZvl0Mq08g9CiGk/I/o2GQ=="],

"am-i-vibing": ["am-i-vibing@0.5.0", "", { "dependencies": { "process-ancestry": "^0.1.0" }, "bin": { "am-i-vibing": "dist/cli.mjs" } }, "sha512-KLcsDhqf1XRrJmJr+9I/C0EX2K+sGrAGZFgkmd84c8TJO9zJBu+/kFInjazu1KfJWFhWDKdRWkpBzEs7s35DVA=="],

"camelize": ["camelize@1.0.1", "", {}, "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ=="],

"capnp-es": ["capnp-es@0.0.16", "", { "peerDependencies": { "typescript": "^5.7.3 || ^6.0.0" }, "optionalPeers": ["typescript"], "bin": { "capnp-es": "dist/compiler/capnpc-js.mjs", "capnpc-js": "dist/compiler/capnpc-js.mjs", "capnpc-ts": "dist/compiler/capnpc-ts.mjs", "capnpc-dts": "dist/compiler/capnpc-dts.mjs" } }, "sha512-pqhhnRqGfDdgHa+rz4JVO9j1jnkyqsHRYrD4RBtIwxCknYSRG7Mjs+x3IRfd20u+ZGS0IhW2L7cDv9ZcIkCYhQ=="],
"capnp-es": ["capnp-es@0.0.17", "", { "peerDependencies": { "typescript": "^5.7.3 || ^6.0.0" }, "optionalPeers": ["typescript"], "bin": { "capnp-es": "dist/compiler/capnpc-js.mjs", "capnpc-js": "dist/compiler/capnpc-js.mjs", "capnpc-ts": "dist/compiler/capnpc-ts.mjs", "capnpc-dts": "dist/compiler/capnpc-dts.mjs" } }, "sha512-uIm/Aju0TNUkL51aBbhPl/2fWsSMiqDjnTnPYyx6oCAQReGCRDl7kZPDNZFer2WhOwR9+B/72olbxUV1GgoKbw=="],

"capnweb": ["capnweb@0.12.0", "", {}, "sha512-jgZ/LMtMVTi+RVlooIslH78Gg23XbDTdvcLghWx3oz17D6u5GuJARt+uhZk/wcTo+f81eeabfnow4d3zLBj+JQ=="],

"word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="],

"workerd": ["workerd@1.20261026.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20261026.1", "@cloudflare/workerd-darwin-arm64": "1.20261026.1", "@cloudflare/workerd-linux-64": "1.20261026.1", "@cloudflare/workerd-linux-arm64": "1.20261026.1", "@cloudflare/workerd-windows-64": "1.20261026.1" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-zMkGDn4DHj7AEDrD0FT3VuaVf9QKWbE3Xg6j8oGt1vE+UtDY5gubW5jcyEYXULy5ojCYwVbmEyDkiukWY7gtVg=="],
"workerd": ["workerd@1.20261117.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20261117.1", "@cloudflare/workerd-darwin-arm64": "1.20261117.1", "@cloudflare/workerd-linux-64": "1.20261117.1", "@cloudflare/workerd-linux-arm64": "1.20261117.1", "@cloudflare/workerd-windows-64": "1.20261117.1" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-iakDbGVtJRiErpWSM5fYT0z3spJ2Mo1x/POsEajBNLqUbTRwm8vMqbB7g8zPN2tzs6eZYNiO5ECyEnAXO9Foxw=="],

"wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="],

"@cloudflare/nimbus-docs/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],

"@effect/platform-bun/@effect/platform-node-shared": ["@effect/platform-node-shared@4.2.0", "", { "dependencies": { "@types/ws": "^8.18.2", "ws": "^8.23.1" }, "peerDependencies": { "effect": "^4.2.0" } }, "sha512-jDUwIMXXv+K0cGVg/3P/rFeDNbmPZw1gMwLBXIl8YWo4tExNtE2BI6fSpiFG2ivF8vQ80ee9IZZ0D2YMoTXIEg=="],

"@effect/platform-node/@effect/platform-node-shared": ["@effect/platform-node-shared@4.2.0", "", { "dependencies": { "@types/ws": "^8.18.2", "ws": "^8.23.1" }, "peerDependencies": { "effect": "^4.2.0" } }, "sha512-jDUwIMXXv+K0cGVg/3P/rFeDNbmPZw1gMwLBXIl8YWo4tExNtE2BI6fSpiFG2ivF8vQ80ee9IZZ0D2YMoTXIEg=="],

"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],

"@foldkit/vite-plugin/@effect/platform-node": ["@effect/platform-node@4.1.7", "", { "dependencies": { "@effect/platform-node-shared": "4.1.7", "undici": "^8.13.1" }, "peerDependencies": { "effect": "^4.1.7", "redis": ">=5.1.0 <7.0.0" } }, "sha512-+hWmfkd5QtfeDKdCnyf+Vs/XK6lnNCfwXWMXWb6YOAyhAQC6qBvHNR5Tx6Lkk8l33eL8xAalHexXF64jL8ABiQ=="],

"@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="],

"@scalar/json-magic/undici": ["undici@8.12.3", "", {}, "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw=="],

"@alchemy.run/node-utils", "@alchemy.run/sql", "@alchemy.run/sigil", "@distilled.cloud/acme", "@distilled.cloud/aws", "@distilled.cloud/axiom", "@distilled.cloud/aws4signer", "@distilled.cloud/cloudflare", "@distilled.cloud/core", "@distilled.cloud/fly-io", "@distilled.cloud/hetzner", "@distilled.cloud/neon", "@distilled.cloud/planetscale", "@distilled.cloud/prisma", "@distilled.cloud/railway", "@distilled.cloud/stripe", "@distilled.cloud/iceberg", "@distilled.cloud/s3", "workerd", "miniflare", ] "effect": { "@effect/platform-browser": "4.1.2", "@effect/platform-bun": "4.1.7", "@effect/platform-node": "4.1.7", "@effect/platform-bun": "4.2.0", "@effect/platform-node": "4.2.0", "effect": "4.1.7" }, "types": { }, "iac": { "@alchemy.run/cloudflare": "2.0.0-beta.87", "alchemy": "2.0.0-beta.87" "@alchemy.run/cloudflare": "2.0.0-beta.88", "alchemy": "2.0.0-beta.88" }, "build": { "@cloudflare/oxlint-config": "0.2.0", "@effect/tsgo": "0.74.1", "@jfalava/ts-standard": "0.3.8", "@jfalava/ts-standard": "0.3.9", "@oxlint/plugins": "1.96.0", "oxfmt": "0.81.0", "oxlint": "1.95.0",

clanka architecture #

clanka gives a chat companion long-term memory. A person writes the companion's persona in a soul.md. Before each reply, a host (Hermes Agent, an MCP client or clanka chat) asks clanka for the companion's context; after it, the host hands back the exchange. The companion then reflects on it, using the same model it chats with, and turns each finished conversation into memory while it sleeps. Everything a companion remembers lives in one encrypted SQLite database on the user's machine. Beside the Rust workspace, a Bun workspace deploys the documentation site and an opt-in diagnostics endpoint to Cloudflare.

Packages #

The Rust workspace is the root Cargo.toml:

crates/core       the memory engine
    ▲
crates/cli        the clanka binary and the host library ──► crates/protocol ◄── crates/app
    ▲                                                                            (runs `clanka rpc`
crates/py         the _clanka Python module                                       as a process)
    ▲
hermes/clanka     the Hermes Agent plugin
  • crates/core (clanka-core): the memory engine; Companion is its handle on one companion. Its modules under crates/core/src/: db opens the database (SQLCipher, WAL, sqlite-vec, the migrations in crates/core/src/migrations/ listed in MIGRATIONS); soul reads the soul.md; context assembles a turn's context; recall is the hybrid full-text and vector search; memory is the guarded write path and the transcript; writer is the reflection after each reply; sleep and dream consolidate a finished conversation or dream; doctor holds the repair tools; lore is shared world reference; diagnostics defines the events the core reports. Everything from outside (the model, the embedder, the clock) comes in through Deps in crates/core/src/deps.rs.
  • crates/cli (clanka): the binary and the library every host uses. crates/cli/src/main.rs declares the commands. Modules under crates/cli/src/: setup finds config.toml, the database key, the embedding model and the companion's model; llm is the OpenAI-compatible model client; turn is the begin and end of one exchange, shared by every front end; chat, mcp and rpc are the front ends; actions holds one function per user action, returning clanka-protocol types, which a command prints and clanka rpc sends; hermes, upgrade, transfer, tidy, diagnostics and triage are the commands of the same names. Depends on crates/core and crates/protocol.
  • crates/protocol (clanka-protocol): the JSON-RPC methods between clanka rpc and the app, each a type implementing Method, and PROTOCOL, which both ends compare in Hello on connect. Depends on no crate here.
  • crates/py (_clanka, PyO3): a companion for Python host plugins. The host's model comes in as a Python callable, and each method releases the GIL while the core works. Depends on crates/core and the crates/cli library.
  • crates/app (clanka-app): the macOS app, on Rune. It links only crates/protocol and reaches companions by starting clanka rpc, as a child for this Mac or over SSH for another machine (crates/app/src/machines.rs). crates/app/bundle.sh builds Clanka.app. Linux never builds it.
  • hermes/clanka/: the Hermes Agent plugin, Python over _clanka, wired through Hermes's hooks (pre_llm_call, post_llm_call, session finalize) and tools (recall_memory, go_to_sleep, wake_up). hermes/nightshade/SOUL.md is the persona of the agent that interviews a person and makes a companion; hermes/install.sh installs a release, hermes/install.ps1 on Windows; hermes/bench.sh runs a scripted evening on a profile. skills/soul-writer/SKILL.md ships in the release archive.

The Bun workspace is the root package.json. One Alchemy stack deploys all of it:

  • iac: iac/alchemy.run.ts is the stack; iac/src/deploy-config.ts reads the deploy config that decides a deployment's hostname, its Access application and whether it has the docs and the console.
  • router: router/src/index.ts, the only Worker with a hostname. It sends /ingest to ingest, /admin to admin and everything else to the docs, over service bindings.
  • ingest: ingest/src/index.ts, the diagnostics endpoint. It checks the sender's token and keeps events in D1 (schema in ingest/migrations/).
  • admin: the telemetry console. admin/src/worker.ts serves the page (admin/src/main.ts) and its read API (admin/src/api.ts) after the Access check in admin/src/server/access.ts.
  • docs: the Nimbus (Astro) site. The CLI pages in docs/src/content/docs/cli/ mirror clanka help, docs/src/content/docs/cli/rpc.mdx documents the protocol, and docs/src/pages/install.sh.ts and install.ps1.ts serve hermes/install.sh and hermes/install.ps1.

One exchange through Hermes #

  1. Hermes calls the plugin's pre_llm_call in hermes/clanka/__init__.py, which calls begin_turn on its _clanka.Companion (crates/py/src/lib.rs).
  2. turn::begin (crates/cli/src/turn.rs) reads the message's markers (zz goodnight, ~~ dream), stops at the doctor token or a frozen memory, records the user's turn and gets the context from Companion::assemble (crates/core/src/context.rs): persona, soul sections, mood, the last note, open threads and recalled memories, within the token budget. The first turn of a host conversation gets all of it; later turns only what the model has not seen.
  3. Hermes's model writes the reply. post_llm_call calls end_turn, and turn::end records the reply. A night that ends here (zz, go_to_sleep, a dream that wakes) is closed at once, so the next message starts a new conversation.
  4. On a background thread the plugin calls reflect: Companion::reflect (crates/core/src/writer.rs) asks the host's model, as the companion, which memories to change, and runs its tool calls through the guarded write path. The plugin holds two handles, so a slow reflection never blocks the next turn.
  5. After a night ends, the plugin calls consolidate: Companion::consolidate (crates/core/src/memory.rs) runs Companion::sleep (crates/core/src/sleep.rs) on each night not yet slept, or the wake pass of crates/core/src/dream.rs on a dream. Sleep writes the night's episode, settles the mood and lets the night's memories drift; it is the only compaction.

clanka chat and clanka mcp run the same steps through crates/cli/src/turn.rs with clanka's own model client, crates/cli/src/llm.rs.

State #

  • The companion database: one file per companion in clanka's data directory, named by the companion's ID. Only crates/core reads or writes it, from every process that holds a Companion: the Hermes plugin, clanka chat, clanka mcp, clanka rpc and the CLI commands, several at once. State they must agree on (the doctor's freeze, the accepted persona) is read from the database on each call, never cached. The transcript is append-only, and every change to mood, notes and soul sections is a new row, so the doctor can roll back.
  • The database key: an entry clanka / <companion id> in the Secret Service, the macOS keychain or Windows Credential Manager (a generic credential named <companion id>.clanka), or a key file when config.toml sets store = "file". Written by clanka init and clanka import, read by crates/cli/src/setup.rs.
  • soul.md: written by the person. clanka init writes the template once; the core only reads and hashes it.
  • Lore: one directory for every companion on the machine. The person writes each entry's Markdown; companions append to its ledger beside it (crates/core/src/lore.rs).
  • config.toml and the embedding model files: read by crates/cli/src/setup.rs; clanka init and clanka embedding download the model.
  • The diagnostics log, diagnostics.jsonl in the data directory: the core emits events, crates/cli/src/diagnostics.rs appends them and, only when config.toml has [diagnostics.upload], sends them to ingest.
  • The clanka-diagnostics D1 database: ingest writes it, admin only reads it.

Entry points #

  • The clanka binary (crates/cli/src/main.rs): commands, plus three long-running front ends: clanka chat in the terminal, clanka mcp as a stdio MCP server and clanka rpc as the app's JSON-RPC peer on stdio.
  • The Hermes plugin (hermes/clanka/), loaded by each Hermes profile that clanka hermes profile sets up.
  • Clanka.app (crates/app), installed by hermes/install.sh on macOS.
  • .github/workflows/ci.yml runs bun run check and the Rust jobs; .github/workflows/advisories.yml checks Cargo.lock against advisories first.
  • .github/workflows/release.yml runs on v* tags and publishes per-target archives with their SHA256SUMS, which hermes/install.sh, hermes/install.ps1 and clanka upgrade (crates/cli/src/upgrade.rs) verify before installing.
  • Cloudflare Workers Builds on the clanka-router Worker runs bun run ci:deploy, which deploys the whole iac/alchemy.run.ts stack.

Invariants #

  • crates/core has no transport, async runtime or network code. Front ends supply the outside world through Deps, and async front ends wrap the blocking core.
  • The companion's own model writes its memory. The writer, sleep and the doctor's re-interpretation are calls to the model the companion chats with, never a separate model.
  • Every memory write checks the freeze and the accepted persona inside its own transaction, and the writer has no tool to edit facts, lower a level, change a seared memory or write the persona.
  • clanka never writes the persona or the Markdown of a lore entry.
  • A diagnostics event holds no text that was said, remembered or written by a model: Event has only numbers, yes/no and fixed words. Nothing leaves the machine without [diagnostics.upload].
  • The app opens no database and no keychain; it only talks to clanka rpc, which listens on no port.
  • admin never writes to D1, and only router has a hostname.
  • The Rust build reads nothing from the Bun workspace.