{"_id":"@bitmonk8/pi-loom","_rev":"2-a3afa3f78c33b6d99e59438d5ecabe9e","name":"@bitmonk8/pi-loom","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.3":{"name":"@bitmonk8/pi-loom","version":"0.1.3","keywords":["pi-package","pi-extension","loom","dsl","prompt-engineering"],"author":{"name":"Thomas Andersen","email":"thomas.andersen@gmail.com"},"license":"MIT OR Apache-2.0","_id":"@bitmonk8/pi-loom@0.1.3","maintainers":[{"name":"bitmonk8","email":"thomas.andersen@gmail.com"}],"homepage":"https://github.com/bitmonk8/pi-loom#readme","bugs":{"url":"https://github.com/bitmonk8/pi-loom/issues"},"pi":{"skills":["./skills"],"extensions":["./extensions"]},"dist":{"shasum":"a20c3edb4b7c6ce98c04b3b8cbd8b0ca1d3e65df","tarball":"https://registry.npmjs.org/@bitmonk8/pi-loom/-/pi-loom-0.1.3.tgz","fileCount":140,"integrity":"sha512-uu10B9Z3z3vnNLIDXKqGu8iZwgpSi79G0UV75ZlOZHNltQK2vVL0XYhWwBC0IN35X2Km9NC6ysZl684T40wfjg==","signatures":[{"sig":"MEUCIAUJ8JDNrtm60+o2gDLFFewmKnHdVYsna9l4TarmmM8HAiEAt9cKLuA5tocux+HBy/QxSxX5Vm1jESS2L0GtU5vwu0Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1978844},"type":"module","engines":{"node":">=22.19.0"},"gitHead":"d6cbd735860ab078bdc1889ff9dec1518f34d992","scripts":{"lint":"eslint --no-error-on-unmatched-pattern \"src/**/*.ts\"","test":"vitest run","build":"tsc -p tsconfig.json","test:live":"vitest run --config config/vitest/vitest.live.config.ts","typecheck":"tsc -p tsconfig.json --noEmit","test:acceptance":"vitest run --config config/vitest/vitest.acceptance.config.ts","test:conformance":"vitest run --config config/vitest/vitest.conformance.config.ts"},"_npmUser":{"name":"bitmonk8","email":"thomas.andersen@gmail.com"},"repository":{"url":"git+ssh://git@github.com/bitmonk8/pi-loom.git","type":"git"},"_npmVersion":"11.13.0","description":"A scripting language for Pi agents: write the predictable parts of an agent task as code and leave only the fuzzy parts to the model.","directories":{},"_nodeVersion":"24.16.0","dependencies":{"ajv":"^8.17.1","yaml":"^2.9.0","semver":"^7.6.0","chokidar":"^4.0.1","minimatch":"^10.0.1","ajv-formats":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.0.0","vitest":"^2.1.8","typescript":"^5.4.0","@types/node":"^22.0.0","@types/semver":"^7.5.0","@earendil-works/pi-ai":"~0.75.5","@earendil-works/pi-tui":"~0.75.5","eslint-plugin-loom-local":"file:./tools/eslint-plugin-loom-local","@typescript-eslint/parser":"^8.0.0","@earendil-works/pi-agent-core":"~0.75.5","@earendil-works/pi-coding-agent":"~0.75.5"},"peerDependencies":{"typebox":"*","@earendil-works/pi-ai":"~0.75.5","@earendil-works/pi-tui":"~0.75.5","@earendil-works/pi-agent-core":"~0.75.5","@earendil-works/pi-coding-agent":"~0.75.5"},"_npmOperationalInternal":{"tmp":"tmp/pi-loom_0.1.3_1784217082345_0.9843595885382264","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @bitmonk8/pi-theta — install @bitmonk8/pi-theta instead."}},"time":{"created":"2026-07-16T15:51:22.170Z","modified":"2026-07-19T18:06:33.925Z","0.1.3":"2026-07-16T15:51:22.555Z"},"bugs":{"url":"https://github.com/bitmonk8/pi-loom/issues"},"author":{"name":"Thomas Andersen","email":"thomas.andersen@gmail.com"},"license":"MIT OR Apache-2.0","homepage":"https://github.com/bitmonk8/pi-loom#readme","keywords":["pi-package","pi-extension","loom","dsl","prompt-engineering"],"repository":{"url":"git+ssh://git@github.com/bitmonk8/pi-loom.git","type":"git"},"description":"A scripting language for Pi agents: write the predictable parts of an agent task as code and leave only the fuzzy parts to the model.","maintainers":[{"name":"bitmonk8","email":"thomas.andersen@gmail.com"}],"readme":"# pi-loom\n\n`pi-loom` is a [Pi Coding Agent](https://github.com/earendil-works/pi-mono)\nextension that adds **Loom**, a scripting language for Pi agents. Write the\npredictable parts of an agent task as code and leave only the genuinely fuzzy\nparts to the model — no custom extension required.\n\nA `.loom` file mixes ordinary code — variables, loops, conditionals, functions —\nwith the text you send to the model. Running a loom adds turns to a conversation:\neither the caller's current one (*prompt mode*) or a fresh, isolated one\n(*subagent mode*). When it succeeds it can also return a\n[*final value*](./docs/reference/errors-and-results.md#final-value-fn-5) — the\nloom's last expression, or the value you `return` — which callers can use and pass\nback across the subagent boundary. Looms can't write files, use the network, or\nspawn processes on their own; those effects happen only through the Pi tools a\nloom is allowed to call (its\n[callable set](./docs/reference/frontmatter.md#tools-callable-set)).\n`.warp` files are library modules that share Loom's grammar and types and are\nimported by `.loom` files; they are never run directly.\n\n## The problem\n\nPi's built-in `prompt` and `subagent` features are just Markdown with some\nfill-in-the-blanks — static text with YAML frontmatter. They can't branch, loop,\nread a model's response, carry a conversation across several turns, or hand a\ntyped value back to the caller. Loom does all of that: your code decides what text\ngoes to the model, the model's replies come back as values, and every run ends in\none of three ways — success, failure, or cancellation — defined in\n[Errors and Results](./docs/reference/errors-and-results.md#terminal-outcomes-closed-set).\n\n## Example: an agent loop\n\nThe pattern people call an *agent loop* (or a *Ralph loop*) is: run the model,\ncheck the result, then stop or go again. The usual version is a shell loop that\nre-runs the model and hopes it eventually declares itself done. In Loom the loop\nis real code, so your code owns the stop condition and the model just does the\nwork inside each round.\n\nThe worker [`docs/examples/ralph-step.loom`](./docs/examples/ralph-step.loom) does\none round of work on a fresh context and hands back a typed result. State lives on\ndisk — the files it edits, the commits it makes — not in the conversation:\n\n```loom\n---\ndescription: Do the next task toward the objective on a fresh context, then report status\nmode: subagent\nparams:\n  objective: string\ntools:\n  - read\n  - bash\n---\nschema Progress {\n  done: boolean,\n  summary: string\n}\n\nlet status: Progress = @`Objective: ${objective}\n\nInspect the current state of the project, do the single most important unfinished\ntask toward the objective, run the test suite with bash, commit the result, and\nreport whether the objective is now fully met.`?\nstatus\n```\n\nThe loop [`docs/examples/ralph.loom`](./docs/examples/ralph.loom) takes an\nobjective, passes it to the worker, and re-runs the worker on a fresh context\nuntil it reports `done` — or hits the round ceiling:\n\n```loom\n---\ndescription: Re-run the worker on a fresh context until the objective is met (a Ralph loop)\nmode: subagent\nparams:\n  objective: string\ntools:\n  - ./ralph-step.loom\n---\nlet mut round = 0\nwhile round < 20 {\n  round += 1\n  let status = ralph_step(objective)?\n  if status.done {\n    return status.summary\n  }\n}\n\"stopped at the 20-round ceiling\"\n```\n\nPut both files on the discovery path with `--loom`, and `ralph.loom` is available\nas the `/ralph` slash command — the argument becomes its `objective`:\n\n```\npi --loom docs/examples -p \"/ralph get the integration tests passing\"\n```\n\nOr, from inside a running `pi` session (once the directory is on your loom\ndiscovery path), just type the slash command:\n\n```\n/ralph get the integration tests passing\n```\n\nThe `while` bound, the `done` check, and the round ceiling are ordinary code —\nnot a magic \"done\" string grepped out of the model's prose. See\n[How to write an agent loop](./docs/how-to/write-an-agent-loop.md) for a second,\nself-contained example you can run without any external tools.\n\n## Status\n\nLoom is at its initial version (**0.1.x**). The whole documented language works and\nis tested end-to-end, but this is an early release and may still contain bugs.\n\nReport issues against the behaviour the [Reference](./docs/reference/) defines.\n\n## Documentation\n\n- **[Guide](./docs/guide.md)** — how Loom works: mixing code with the text you\n  send to the model, prompt vs. subagent mode, `.loom` vs. `.warp`, and the final\n  value.\n- **[Tutorial](./docs/tutorial.md)** — build your first loom, from an empty file\n  to a working one.\n- **[How-to guides](./docs/how-to/)** — short recipes for specific tasks, including\n  [writing an agent loop](./docs/how-to/write-an-agent-loop.md).\n- **[Reference](./docs/reference/)** — the full details: grammar, type system,\n  frontmatter fields, errors and results, limits, diagnostics, and the CLI.\n</content>\n</invoke>\n","readmeFilename":"README.md"}