{"_id":"@anythingai/teleprompt","_rev":"6-970ebd03aedd7964a21f346d19f77984","name":"@anythingai/teleprompt","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@anythingai/teleprompt","version":"0.1.0","keywords":["prompt","llm","ai","system-prompt","prompt-builder","prompt-composition","composable"],"license":"MIT","_id":"@anythingai/teleprompt@0.1.0","maintainers":[{"name":"failingbuild","email":"marcus@create.xyz"},{"name":"arnavsurve","email":"arnav@anything.com"},{"name":"daniel1234567890","email":"dchen0@pm.me"},{"name":"zobeirhamid","email":"hamid.zobeir@gmail.com"},{"name":"pgk1216","email":"pgk1216@gmail.com"},{"name":"jpulec","email":"james@create.xyz"}],"homepage":"https://github.com/Create-Inc/teleprompt#readme","bugs":{"url":"https://github.com/Create-Inc/teleprompt/issues"},"dist":{"shasum":"26fc10d1103e655914f303d37a49920c1063e834","tarball":"https://registry.npmjs.org/@anythingai/teleprompt/-/teleprompt-0.1.0.tgz","fileCount":17,"integrity":"sha512-bMBD3RN/197qLx5TOjTW8keGbpO4ixz9oE6oqvhFi6rnoo8opXFQVhjpaQcOMUhTJMpqIMKuA24pUSm1yhW6QA==","signatures":[{"sig":"MEQCIFpA+BcZquaxraiQpgNuNbSEdhoaoY2mhJW/85Z0tF5VAiBQloax1LQpGBJoqgISx2T9nbbcZQPaYsasv3sYhwfLGw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37982},"main":"./dist/index.cjs","type":"module","_from":"file:anythingai-teleprompt-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}}},"scripts":{"attw":"attw --pack . --profile node16","lint":"biome check .","test":"vitest run","build":"tsup","check":"pnpm lint && pnpm typecheck && pnpm test && pnpm publint && pnpm attw","publint":"publint","lint:fix":"biome check --write .","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"arnavsurve","email":"arnav@anything.com"},"_resolved":"/private/var/folders/w4/1bfcnsms0gd_pgbw3j_55fv80000gn/T/9cd2cc63803dccbae6bfb61c3597f7b1/anythingai-teleprompt-0.1.0.tgz","_integrity":"sha512-bMBD3RN/197qLx5TOjTW8keGbpO4ixz9oE6oqvhFi6rnoo8opXFQVhjpaQcOMUhTJMpqIMKuA24pUSm1yhW6QA==","repository":{"url":"git+https://github.com/Create-Inc/teleprompt.git","type":"git"},"_npmVersion":"11.6.2","description":"Composable, declarative prompt builder for LLM system prompts","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.4.0","vitest":"^3.0.0","publint":"^0.3.0","typescript":"^5.7.0","@biomejs/biome":"^1.9.0","@arethetypeswrong/cli":"^0.17.0"},"_npmOperationalInternal":{"tmp":"tmp/teleprompt_0.1.0_1771545890480_0.9855281261710411","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@anythingai/teleprompt","version":"0.1.1","keywords":["prompt","llm","ai","system-prompt","prompt-builder","prompt-composition","composable"],"license":"MIT","_id":"@anythingai/teleprompt@0.1.1","maintainers":[{"name":"failingbuild","email":"marcus@create.xyz"},{"name":"arnavsurve","email":"arnav@anything.com"},{"name":"daniel1234567890","email":"dchen0@pm.me"},{"name":"zobeirhamid","email":"hamid.zobeir@gmail.com"},{"name":"pgk1216","email":"pgk1216@gmail.com"},{"name":"jpulec","email":"james@create.xyz"}],"homepage":"https://github.com/Create-Inc/teleprompt#readme","bugs":{"url":"https://github.com/Create-Inc/teleprompt/issues"},"dist":{"shasum":"af4e87334d732e2a796d7ffcb73f6b483699f581","tarball":"https://registry.npmjs.org/@anythingai/teleprompt/-/teleprompt-0.1.1.tgz","fileCount":17,"integrity":"sha512-Ux4DjRzNMCtGDx+kZ+GC0T27i/CTIQ0M33wlvJFPnhdXyONR/dVPaPjaKtC9lr9pDeSsyjb4ezpbOspG9bvhIA==","signatures":[{"sig":"MEYCIQCDevWu5vFEC27gmiaZxLPOVdqin3JNSAssoZ0nYTwCngIhAJw8t1G5c61xsjZStTAcQoxo4iDcvGFqAbcntbjeSAi1","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37982},"main":"./dist/index.cjs","type":"module","_from":"file:anythingai-teleprompt-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}}},"scripts":{"attw":"attw --pack . --profile node16","lint":"biome check .","test":"vitest run","build":"tsup","check":"pnpm lint && pnpm typecheck && pnpm test && pnpm publint && pnpm attw","publint":"publint","lint:fix":"biome check --write .","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"arnavsurve","email":"arnav@anything.com"},"_resolved":"/private/var/folders/w4/1bfcnsms0gd_pgbw3j_55fv80000gn/T/ff233ec6d0d64872bc0b36b38f5c2658/anythingai-teleprompt-0.1.1.tgz","_integrity":"sha512-Ux4DjRzNMCtGDx+kZ+GC0T27i/CTIQ0M33wlvJFPnhdXyONR/dVPaPjaKtC9lr9pDeSsyjb4ezpbOspG9bvhIA==","repository":{"url":"git+https://github.com/Create-Inc/teleprompt.git","type":"git"},"_npmVersion":"11.6.2","description":"Composable, declarative prompt builder for LLM system prompts","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.4.0","vitest":"^3.0.0","publint":"^0.3.0","typescript":"^5.7.0","@biomejs/biome":"^1.9.0","@arethetypeswrong/cli":"^0.17.0"},"_npmOperationalInternal":{"tmp":"tmp/teleprompt_0.1.1_1771546001302_0.7227272556657351","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anythingai/teleprompt","version":"0.2.0","keywords":["prompt","llm","ai","system-prompt","prompt-builder","prompt-composition","composable"],"license":"MIT","_id":"@anythingai/teleprompt@0.2.0","maintainers":[{"name":"failingbuild","email":"marcus@create.xyz"},{"name":"arnavsurve","email":"arnav@anything.com"},{"name":"daniel1234567890","email":"dchen0@pm.me"},{"name":"zobeirhamid","email":"hamid.zobeir@gmail.com"},{"name":"pgk1216","email":"pgk1216@gmail.com"},{"name":"jpulec","email":"james@create.xyz"}],"homepage":"https://github.com/Create-Inc/teleprompt#readme","bugs":{"url":"https://github.com/Create-Inc/teleprompt/issues"},"dist":{"shasum":"c93d3196454949a18750470afa26a359e2eaf939","tarball":"https://registry.npmjs.org/@anythingai/teleprompt/-/teleprompt-0.2.0.tgz","fileCount":17,"integrity":"sha512-9VtEX5Snk8/ixgT3ExZq8hkYeXweUn2EQN+hN54s7O1JokpcBLilyX9qqiVwoDlsljrwEEg8Jjt6AV/Qi7kJDA==","signatures":[{"sig":"MEUCIA7GhajpWyi6cNScNkKQN+03c4r4+8aIK7Xu6lbrtYjTAiEA1ZSYC3g7ebEbX+6a7ymoDkqIu/rvOvRLekmSxHA+GYQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":75300},"main":"./dist/index.cjs","pnpm":{"onlyBuiltDependencies":["@biomejs/biome","esbuild"]},"type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}}},"gitHead":"68b0901263399173f630a2bbdf57fda497ce9774","scripts":{"attw":"attw --pack . --profile node16","lint":"biome check .","test":"vitest run","build":"tsup","check":"pnpm lint && pnpm typecheck && pnpm test && pnpm publint && pnpm attw","publint":"publint","lint:fix":"biome check --write .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"pnpm check && pnpm build"},"_npmUser":{"name":"arnavsurve","email":"arnav@anything.com"},"repository":{"url":"git+https://github.com/Create-Inc/teleprompt.git","type":"git"},"_npmVersion":"11.6.2","description":"Composable, declarative prompt builder for LLM system prompts","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.30.0+sha512.2b5753de015d480eeb88f5b5b61e0051f05b4301808a82ec8b840c9d2adf7748eb352c83f5c1593ca703ff1017295bc3fdd3119abb9686efc96b9fcb18200937","devDependencies":{"tsx":"^4.21.0","tsup":"^8.4.0","vitest":"^3.0.0","publint":"^0.3.0","typescript":"^5.7.0","@biomejs/biome":"^1.9.0","@arethetypeswrong/cli":"^0.17.0"},"_npmOperationalInternal":{"tmp":"tmp/teleprompt_0.2.0_1772244857819_0.7061170789219751","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@anythingai/teleprompt","version":"0.3.0","keywords":["prompt","llm","ai","system-prompt","prompt-builder","prompt-composition","composable"],"license":"MIT","_id":"@anythingai/teleprompt@0.3.0","maintainers":[{"name":"failingbuild","email":"marcus@create.xyz"},{"name":"arnavsurve","email":"arnav@anything.com"},{"name":"daniel1234567890","email":"dchen0@pm.me"},{"name":"zobeirhamid","email":"hamid.zobeir@gmail.com"},{"name":"pgk1216","email":"pgk1216@gmail.com"},{"name":"jpulec","email":"james@create.xyz"}],"homepage":"https://github.com/Create-Inc/teleprompt#readme","bugs":{"url":"https://github.com/Create-Inc/teleprompt/issues"},"dist":{"shasum":"a34a8ebf7c4a95bad911222a4c2a6abe15f9ea93","tarball":"https://registry.npmjs.org/@anythingai/teleprompt/-/teleprompt-0.3.0.tgz","fileCount":18,"integrity":"sha512-CNmcjIXTNcubkwqX1jHdY6SwhUMe75+6RuYGYvnmv+nKgJsw/9xGk01c2lZrWQJlPbuTPKE1UtnZROgxxRVoeQ==","signatures":[{"sig":"MEYCIQDdAN3MsQN2v5jvXBwSIpsLJeTItgTaRE5xu/D5S3+m1wIhAJecKwud1HWCiUXws8NgdT3ViPShJ6/sswjQVjiAMfyT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65939},"main":"./dist/index.cjs","type":"module","_from":"file:anythingai-teleprompt-0.3.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}}},"scripts":{"attw":"attw --pack . --profile node16","lint":"biome check .","test":"vitest run","build":"tsup","check":"pnpm lint && pnpm typecheck && pnpm test && pnpm publint && pnpm attw","publint":"publint","lint:fix":"biome check --write .","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"arnavsurve","email":"arnav@anything.com"},"_resolved":"/private/var/folders/w4/1bfcnsms0gd_pgbw3j_55fv80000gn/T/b6ad181e6cd2338b6cd0ea3433dca239/anythingai-teleprompt-0.3.0.tgz","_integrity":"sha512-CNmcjIXTNcubkwqX1jHdY6SwhUMe75+6RuYGYvnmv+nKgJsw/9xGk01c2lZrWQJlPbuTPKE1UtnZROgxxRVoeQ==","repository":{"url":"git+https://github.com/Create-Inc/teleprompt.git","type":"git"},"_npmVersion":"11.6.2","description":"Composable, declarative prompt builder for LLM system prompts","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.4.0","vitest":"^3.0.0","publint":"^0.3.0","typescript":"^5.7.0","@biomejs/biome":"^1.9.0","@arethetypeswrong/cli":"^0.17.0"},"_npmOperationalInternal":{"tmp":"tmp/teleprompt_0.3.0_1774465921274_0.8409278605866437","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-02-20T00:04:50.356Z","modified":"2026-07-28T03:57:24.593Z","0.1.0":"2026-02-20T00:04:50.646Z","0.1.1":"2026-02-20T00:06:41.467Z","0.2.0":"2026-02-28T02:14:17.965Z","0.3.0":"2026-03-25T19:12:01.528Z"},"bugs":{"url":"https://github.com/Create-Inc/teleprompt/issues"},"license":"MIT","homepage":"https://github.com/Create-Inc/teleprompt#readme","keywords":["prompt","llm","ai","system-prompt","prompt-builder","prompt-composition","composable"],"repository":{"url":"git+https://github.com/Create-Inc/teleprompt.git","type":"git"},"description":"Composable, declarative prompt builder for LLM system prompts","maintainers":[{"email":"marcus@create.xyz","name":"failingbuild"},{"email":"arnav@anything.com","name":"arnavsurve"},{"email":"pgk1216@gmail.com","name":"pgk1216"},{"email":"james@create.xyz","name":"jpulec"}],"readme":"# teleprompt\n\nComposable, section-based LLM system prompts.\n\nEach section owns its content and conditional logic. Sections can be reused across prompt variants, conditionally included, and rendered as plain text or XML.\n\n```bash\npnpm add @anythingai/teleprompt\n```\n\n## Quick Start\n\n```ts\nimport { PromptBuilder, section, type PromptContext } from '@anythingai/teleprompt';\n\n// Define your context shape\ntype MyFlags = { webSearchEnabled: boolean };\ntype MyVars = { assistantName: string };\ntype MyContext = PromptContext<MyFlags, MyVars>;\n\n// Static section — no context needed, no type parameter\nconst guidelines = section('guidelines', () => `# Guidelines\n- Be concise and direct.\n- Cite sources when making factual claims.\n- Ask for clarification when a request is ambiguous.`);\n\n// Dynamic section — uses context\nconst identity = section('identity', (ctx: MyContext) =>\n  `You are ${ctx.vars.assistantName}, a helpful AI assistant.`\n);\n\n// Conditional section — return null to exclude\nconst webSearch = section('web-search', (ctx: MyContext) => {\n  if (!ctx.flags.webSearchEnabled) return null;\n  return `You have access to web search. Use it when the user asks about\ncurrent events or information that may have changed after your training cutoff.`;\n});\n\n// Compose and build\nconst prompt = new PromptBuilder<MyContext>()\n  .use(identity)\n  .use(guidelines)\n  .use(webSearch)\n  .build({\n    flags: { webSearchEnabled: true },\n    vars: { assistantName: 'Daniel' },\n  });\n```\n\n## Sections\n\n`section(id, render)` takes an id and a render function. Return a string to include, `null` to exclude:\n\n```ts\n// Always included\nconst rules = section('rules', () => 'Be helpful and concise.');\n\n// Conditional — null means excluded\nconst citation = section('citation', (ctx: MyContext) => {\n  if (!ctx.flags.citationEnabled) return null;\n  return 'Always include citations with links when referencing external sources.';\n});\n```\n\nSections render in the order you call `.use()`. To reorder, change the call order.\n\nStatic sections (no type parameter) work in any builder:\n\n```ts\nconst disclaimer = section('disclaimer', () => 'Responses are not legal advice.');\n\n// Works in any builder regardless of context type\nnew PromptBuilder<MyContext>().use(disclaimer)\nnew PromptBuilder<OtherContext>().use(disclaimer)\n```\n\n## Context\n\nSections receive a typed context with boolean flags and arbitrary variables:\n\n```ts\ntype MyFlags = {\n  webSearchEnabled: boolean;\n  citationEnabled: boolean;\n};\n\ntype MyVars = {\n  assistantName: string;\n  language: string;\n};\n\ntype MyContext = PromptContext<MyFlags, MyVars>;\n```\n\n`PromptContext` and `PromptBuilder` have defaults, so the type parameter is optional:\n\n```ts\nconst builder = new PromptBuilder();\n```\n\nBuild the context once and pass it to `.build(ctx)`. Every section receives the same object.\n\n## Forking\n\nCreate variants from a shared base:\n\n```ts\nconst base = new PromptBuilder<MyContext>()\n  .use(identity)\n  .use(guidelines)\n  .use(tone);\n\n// Customer support agent — adds escalation rules\nconst supportAgent = base.fork()\n  .use(escalationPolicy)\n  .use(ticketFormat);\n\n// Code assistant — swaps guidelines, drops tone\nconst codeAssistant = base.fork()\n  .without(guidelines)\n  .without(tone)\n  .use(codingGuidelines)\n  .use(outputFormat);\n```\n\nEach fork is independent. Modifying one doesn't affect the others.\n\n## XML Format\n\nBoth Claude and Gemini recommend structuring prompts with XML tags. Pass `{ format: 'xml' }` to `.build()` to wrap each section in `<id>` tags:\n\n```ts\nbuilder.build(ctx, { format: 'xml' })\n```\n\nThe section id becomes the tag name. Content is left as-is inside the tags.\n\n## Groups\n\nGroup related sections together. In text mode, groups are transparent. In XML mode, they wrap children in tags:\n\n```ts\nconst prompt = new PromptBuilder<MyContext>()\n  .use(identity)\n  .group('tools', b => b\n    .use(webSearch)\n    .use(calculator)\n  )\n  .use(guidelines)\n  .build(ctx, { format: 'xml' });\n```\n\n```xml\n<identity>\nYou are Daniel, a helpful AI assistant.\n</identity>\n\n<tools>\n<web-search>\nYou have access to web search...\n</web-search>\n\n<calculator>\nYou can evaluate math expressions...\n</calculator>\n</tools>\n\n<guidelines>\n# Guidelines\n...\n</guidelines>\n```\n\nGroups can be nested:\n\n```ts\nbuilder.group('capabilities', b => b\n  .group('tools', b => b\n    .use(webSearch)\n    .use(calculator)\n  )\n  .group('integrations', b => b\n    .use(slack)\n    .use(linear)\n  )\n)\n```\n\n## Mutually Exclusive Sections\n\nUse `.useOneOf()` when exactly one of several sections should render. The first candidate that returns a non-empty string wins:\n\n```ts\nconst hasTasks = section('has-tasks', (ctx: MyContext) => {\n  if (ctx.vars.tasks.length === 0) return null;\n  return `## Active Tasks\\n\\n${ctx.vars.tasks.map(t => `- ${t.title}`).join('\\n')}`;\n});\n\nconst noTasks = section('no-tasks', () => '## Active Tasks\\n\\nNo tasks currently running.');\n\nbuilder.useOneOf(hasTasks, noTasks);\n```\n\n## Builder API\n\n```ts\nnew PromptBuilder<MyContext>()\n  .use(section)                      // append (replaces if same id)\n  .useOneOf(sectionA, sectionB)      // first match wins\n  .group('name', b => b.use(...))    // named group (XML wrapper)\n  .without(section)                  // remove by object or string id\n  .has(section)                      // check existence\n  .ids()                             // list all section ids\n  .fork()                            // independent copy\n  .build(ctx)                        // render to string\n  .build(ctx, { format: 'xml' })     // render with XML tags\n  .buildWithMeta(ctx)                // render + { included, excluded }\n```\n\n## Testing\n\n```ts\nimport { mockContext, renderSection } from '@anythingai/teleprompt/testing';\n\n// Render a section in isolation\nconst output = renderSection(webSearch, { flags: { webSearchEnabled: true } });\nexpect(output).toContain('web search');\n\n// Assert on prompt structure\nconst { included, excluded } = builder.buildWithMeta(ctx);\nexpect(included).toContain('web-search');\nexpect(excluded).toContain('citation');\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}