promptfarm
v0.4.1
Published
PromptFarm CLI for prompt runtime workflows and persona YAML composition.
Downloads
36
Maintainers
Readme
PromptFarm 🌾
Prompt infrastructure CLI for building, validating, resolving, and composing prompts/personas like software artifacts.
Think: TypeScript/Terraform mindset for prompts: structure, contracts, reproducibility.
Why PromptFarm
Most teams still keep prompts as random text versions. PromptFarm treats them as typed, testable, composable artifacts with deterministic outputs.
What You Get
- Runtime CLI flow:
validate -> resolve -> evaluate -> blueprint -> build - Prompt tooling commands:
init,discover,render,search,info,context,doctor, etc. - Persona composition:
persona-resolvepersona-buildpersona-build-all
- Multi-file persona reuse via
extends - Deterministic merges for style/rules/params/output
- Schema lookup by
schema_ref - Auto-generated LLM JSON shape in final frontmatter:
output.expected_json
Install
npm install -g promptfarm
promptfarm --helpQuick Runtime Example
promptfarm validate --cwd examples/evaluation
promptfarm resolve architecture_review --cwd examples/evaluation --format json
promptfarm evaluate architecture_review --cwd examples/evaluation --format json
promptfarm blueprint architecture_review --cwd examples/evaluation --format json
promptfarm build --cwd examples/builders --format jsonPersona Quickstart
Structure:
synthetics/
blocks/
persona.base.yaml
capability.json-output.yaml
params.shared.yaml
render.persona-body.md
schemas/
outreach-messages.v1.yaml
personas/
outreach-specialist.yamlResolve:
promptfarm persona-resolve synthetics/personas/outreach-specialist.yaml \
--cwd . \
--schema-dir synthetics/schemas \
--format jsonBuild one persona:
promptfarm persona-build synthetics/personas/outreach-specialist.yaml \
--cwd . \
--schema-dir synthetics/schemas \
--out dist/outreach_specialist.md \
--format jsonBuild all personas in folder:
promptfarm persona-build-all synthetics/personas \
--cwd . \
--schema-dir synthetics/schemas \
--out-dir dist \
--format jsonPersona Output Model (LLM-optimized)
Final markdown keeps output compact:
output.expected_jsonis generated from schema automatically- noisy fields are omitted in final artifact:
format,schema_ref,type, raw schema object
JSON-shape generation rules:
object: fromproperties(required keys first)array: one-item example arraystring:"..."(or"a | b | c"forenum)number/integer:0boolean:falseconst: const valueoneOf/anyOf/allOf: first variant
Template File
Use separate template file, e.g. blocks/render.persona-body.md:
render:
template: ../blocks/render.persona-body.mdPath is resolved relative to YAML file where render.template is declared.
Supported template syntax:
{{field}}and dotted paths (e.g.{{body_defaults.output_instruction}}){{output.expected_json}}- loops:
{{#each items}}...{{/each}} {{this}}/{{this.someField}}
Real Project Usage
For your own project folder:
promptfarm persona-build-all synthetics/personas \
--cwd . \
--schema-dir synthetics/schemas \
--out-dir dist \
--format jsonUse persona-build when you need to build a single persona file.
License
PolyForm-Noncommercial-1.0.0 © Andrei Tazetdinov
