{"_id":"@6digit/mnemonics","_rev":"4-3eca7d04471995b7f704c7412a92fbc1","name":"@6digit/mnemonics","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@6digit/mnemonics","version":"0.1.0","keywords":["mnemonic","semantic","evaluation","subscript","expression","fragment","dynamic"],"author":{"name":"6digit Studio"},"license":"MIT","_id":"@6digit/mnemonics@0.1.0","maintainers":[{"name":"cocporn","email":"cocporn@gmail.com"}],"homepage":"https://github.com/6digit/arbiter#readme","bugs":{"url":"https://github.com/6digit/arbiter/issues"},"dist":{"shasum":"89c288d1b1210bc07198fc2b603d1fa39418622f","tarball":"https://registry.npmjs.org/@6digit/mnemonics/-/mnemonics-0.1.0.tgz","fileCount":10,"integrity":"sha512-p5wtDQVRdCkckJMSK2pADhCoq2d40OP9NAlbLxoQGIX5lazAGE69sCHUYJRdKraxljA3gcepVtyvejCajfvcOA==","signatures":[{"sig":"MEUCIAhASLl5LMM2gU9WHUEvuQaXftnAe455R5c7Wz58wkOsAiEAlwF7k6JbE4g/Ix5HY9LwhicamIcjeZokpTsIjtBMAZM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26091},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"a5c80c5a91c36eba088644d165ad804e6d71ede0","scripts":{"dev":"tsc --watch","test":"vitest","build":"tsc","clean":"rm -rf dist","test:watch":"vitest --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"cocporn","email":"cocporn@gmail.com"},"repository":{"url":"git+https://github.com/6digit/arbiter.git","type":"git","directory":"packages/mnemonics"},"_npmVersion":"11.4.2","description":"Dynamic semantic evaluation system for Fragment data using Subscript expressions","directories":{},"_nodeVersion":"23.2.0","dependencies":{"subscript":"^9.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mnemonics_0.1.0_1755132968808_0.6868875846032894","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@6digit/mnemonics","version":"0.2.0","keywords":["mnemonic","semantic","evaluation","subscript","expression","fragment","dynamic"],"author":{"name":"6digit Studio"},"license":"MIT","_id":"@6digit/mnemonics@0.2.0","maintainers":[{"name":"cocporn","email":"cocporn@gmail.com"}],"homepage":"https://github.com/6digit/arbiter#readme","bugs":{"url":"https://github.com/6digit/arbiter/issues"},"dist":{"shasum":"f02769b089b695068b4e0c30e06e0c2da752f2af","tarball":"https://registry.npmjs.org/@6digit/mnemonics/-/mnemonics-0.2.0.tgz","fileCount":10,"integrity":"sha512-8Bb1y2Fx5AicGAUB50qq5q0DfIW3QhDRcRn5k/ab6X9VwENscvO0Zl5O47qUQP0EdyGdV3102tej35sPF1T8Ew==","signatures":[{"sig":"MEUCIQD0tJNYnXdoxn+BH1xodc2PFKh4ggU7Or9DeAhikIguuQIgeiM/8CD/+1JpDT5A/a6GLKW9LLhm+JM3Xn0SrBwm6sU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42420},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"b63c94a5562b49b0e7bb207e9c90a81bd7c25c4b","scripts":{"dev":"tsc --watch","test":"vitest","build":"tsc","clean":"rm -rf dist","test:watch":"vitest --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"cocporn","email":"cocporn@gmail.com"},"repository":{"url":"git+https://github.com/6digit/arbiter.git","type":"git","directory":"packages/mnemonics"},"_npmVersion":"11.4.2","description":"Dynamic semantic evaluation system for Fragment data using Subscript expressions","directories":{},"_nodeVersion":"23.2.0","dependencies":{"subscript":"^9.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mnemonics_0.2.0_1755173386836_0.2797909461468471","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@6digit/mnemonics","version":"0.3.0","keywords":["mnemonic","semantic","evaluation","subscript","expression","fragment","dynamic"],"author":{"name":"6digit Studio"},"license":"MIT","_id":"@6digit/mnemonics@0.3.0","maintainers":[{"name":"cocporn","email":"cocporn@gmail.com"}],"homepage":"https://github.com/6digit/arbiter#readme","bugs":{"url":"https://github.com/6digit/arbiter/issues"},"dist":{"shasum":"2c60e39a7f5026c80db6a49c52c6b2e8deac7bc5","tarball":"https://registry.npmjs.org/@6digit/mnemonics/-/mnemonics-0.3.0.tgz","fileCount":10,"integrity":"sha512-yLDB7Lr/ZKQ+1X7j9vgL2MvBcvCPgbGEuTMigDkdvLaaIS1b/GVSkDuL487BpH+995pcq9exdsrBs3KiB3+xCA==","signatures":[{"sig":"MEYCIQDfhR+hLL0I86YxO5ezxu3chWcoJ5kTdZkKWnqIKZz/BwIhAMEh67ylvdvkMk8FaJMQv1xoeSi74N9k0E3DxD7AH6q7","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42421},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"28a8756783f0fb731295edb921870a8c2e7af3ab","scripts":{"dev":"tsc --watch","test":"vitest","build":"tsc","clean":"rm -rf dist","test:watch":"vitest --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"cocporn","email":"cocporn@gmail.com"},"repository":{"url":"git+https://github.com/6digit/arbiter.git","type":"git","directory":"packages/mnemonics"},"_npmVersion":"11.4.2","description":"Dynamic semantic evaluation system for Fragment data using Subscript expressions","directories":{},"_nodeVersion":"23.2.0","dependencies":{"subscript":"^9.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mnemonics_0.3.0_1755284714808_0.1609555806856824","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@6digit/mnemonics","version":"0.5.0","description":"Reader-shaped evaluator for named expressions over an environment. Brutal, async-capable, programmable resolver chain.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","test":"bun test","test:watch":"bun test --watch","typecheck":"tsc --noEmit","prepublishOnly":"bun test && bun run clean && bun run build"},"keywords":["mnemonic","expression","evaluator","subscript","reader-monad","environment","vocabulary","resolver","semantic"],"author":{"name":"6digit Studio"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/6digit-studio/mnemonics.git"},"homepage":"https://github.com/6digit-studio/mnemonics#readme","bugs":{"url":"https://github.com/6digit-studio/mnemonics/issues"},"publishConfig":{"access":"public"},"dependencies":{"subscript":"^10.4.2"},"devDependencies":{"@types/bun":"latest","typescript":"^5"},"gitHead":"fe01ba047c36881ef0bdd4538a04a932dccb578b","_id":"@6digit/mnemonics@0.5.0","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-FbBHWwAPdLtSrUyO0uoG3mFVuLYgkQh9DfoxWRDA5VRKGgGRgNSqzZH5cGorECyU4ObGgU2R5LMYHYodnErRzg==","shasum":"795c767df10d898ea329a4a596c58d17c22489e3","tarball":"https://registry.npmjs.org/@6digit/mnemonics/-/mnemonics-0.5.0.tgz","fileCount":20,"unpackedSize":53566,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCtsSF2swc/hMW3XVpU4sJsqyBTeMg1Cm53IL30+xx/5wIgbnIGva+EEAL2grk/kSGhFkoGlXTosTPNK03y9K9wmk8="}]},"_npmUser":{"name":"cocporn","email":"cocporn@gmail.com"},"directories":{},"maintainers":[{"name":"cocporn","email":"cocporn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mnemonics_0.5.0_1778421377498_0.778185756842704"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-14T00:56:08.639Z","modified":"2026-05-10T13:56:17.765Z","0.1.0":"2025-08-14T00:56:08.989Z","0.2.0":"2025-08-14T12:09:47.034Z","0.3.0":"2025-08-15T19:05:14.993Z","0.5.0":"2026-05-10T13:56:17.631Z"},"bugs":{"url":"https://github.com/6digit-studio/mnemonics/issues"},"author":{"name":"6digit Studio"},"license":"MIT","homepage":"https://github.com/6digit-studio/mnemonics#readme","keywords":["mnemonic","expression","evaluator","subscript","reader-monad","environment","vocabulary","resolver","semantic"],"repository":{"type":"git","url":"git+https://github.com/6digit-studio/mnemonics.git"},"description":"Reader-shaped evaluator for named expressions over an environment. Brutal, async-capable, programmable resolver chain.","maintainers":[{"name":"cocporn","email":"cocporn@gmail.com"}],"readme":"# @6digit/mnemonics\n\nA **mnemonic** is a name bound to an expression. The expression is evaluated\nunder a provided environment. The environment carries everything the\nexpression needs — entity data, ambient state, other mnemonics, native\nhelpers. The mnemonic itself stays a small pure thing that names a meaning.\n\nThat shape is the Reader monad: `Reader<Env, Value>`. The shape is what\nmatters; the term is incidental.\n\n## What it gives you\n\nA substrate for **named, evaluatable concepts** that compose. Same primitive\ncovers:\n\n- predicates (`is_visible`, `should_evolve`)\n- numeric formulas (`damage`, `effective_speed`)\n- state transformations (`apply_blessing`)\n- narrative pieces (`act_one_summary`)\n- deferred references that other code can run later\n\nThe kernel returns whatever the expression produces — booleans stay booleans,\nobjects stay objects. No coercion.\n\n## Install\n\n```sh\nnpm install @6digit/mnemonics\n# or\nbun add @6digit/mnemonics\n```\n\nPeer requirement: `subscript ^10`.\n\n## Quick start\n\n```ts\nimport { MnemonicEvaluator } from '@6digit/mnemonics';\n\nconst source = {\n  get(name: string) {\n    return {\n      damage: { name: 'damage', expression: 'base * power' },\n      base:   { name: 'base',   expression: '10' },\n    }[name];\n  },\n};\n\nconst evaluator = new MnemonicEvaluator({ source });\n\nconst result = await evaluator.evaluate('damage', { power: 3 });\n// result.value      === 30\n// result.contextRead   → ['power']  (env keys actually read)\n// result.mnemonicDeps  → ['base']   (sub-mnemonics that resolved)\n```\n\n## What's in the box\n\nThe package ships in layers. Each layer has its own invariants and dense\ntest bed; layers are decoupled — you can use the kernel without the\nvocabulary layer, the vocabulary layer without async resolvers, and so on.\n\n- **L0 — Kernel.** Recursive evaluator over `subscript` AST. Reader-shaped:\n  every recursion derives a fresh env, never mutates. Cycle detection,\n  max-depth protection. Read-set tracked transitively via Proxy. Errors\n  carry the full chain.\n- **L1 — Vocabulary.** A mnemonic is `{name, summary?, description?, expression, type?, returnType?}`. Sources can `list()` cheap previews\n  (titles + summaries) without paying the full-read cost.\n- **L2 — Programmable resolver.** Name resolution is a composable chain\n  of `(name, ctx) => Value | Promise<Value>` stages. Custom resolvers\n  prepend; defaults handle env lookup and mnemonic recursion. The chain\n  is the **only** way a name becomes a value.\n- **L3 — `with(...)` shadowing.** The only parameter-passing mechanism.\n  `with(prompt: \"hi\", body)` evaluates `body` under the env extended with\n  `prompt = \"hi\"`, then discards the extension. Mnemonics don't take\n  arguments — you shadow what they read.\n- **L4 — Async resolvers.** Resolvers may return promises. Independent\n  name resolutions run in parallel. Async errors propagate with the full\n  chain.\n- **L5 — `ref()` quotation.** A first-class deferred-reference primitive.\n  `ref(\"name\")` returns a value that names a mnemonic without running it;\n  `evaluator.run(reference, env?)` evaluates it later, optionally under\n  a different env. Decoupled from any mutation system.\n\nSee [`VISION.md`](./VISION.md) for the full design and invariants.\n\n## Brutal invariants\n\n- **Fail loud.** Cycles, missing refs, type mismatches, async errors —\n  all structural, all noisy. No silent fallbacks.\n- **AST, not strings.** Every name-extraction question is answered by\n  walking subscript's AST. Property keys, method names, and call callees\n  are distinguished structurally.\n- **No mutation.** Caller env is never mutated. Recursive resolutions\n  build fresh, scoped contexts.\n- **No coercion.** Expression results pass through untouched.\n- **The chain is the truth.** Every error names every link in the\n  recursive resolution path.\n\n## Status\n\nPre-1.0 — the API may still shift before stabilization.\n71 tests passing across kernel, analysis, and intent layers.\n\n## License\n\nMIT — see [`LICENSE`](./LICENSE).\n","readmeFilename":"README.md"}