Generate specialized AI agents using first principles thinking.
TypeScript
34
15 commits
updated Jul 6, 2026
Principles is a powerful and flexible framework that enables you to generate specialized AI agents based on a goal or problem statement. By applying first principles thinking, Principles breaks down your goal into its most fundamental truths or components—the smallest, indivisible parts of the problem. It then generates a network of collaborating agents that address each fundamental component. This approach allows you to create highly effective AI solutions tailored to your specific needs, enabling you to process subsequent prompts with greater accuracy and efficiency than general-purpose language models.
Note: This framework was designed as an experiment, and the code may require refining in some places.
For a more exhaustive discussion of the Principles Framework, explore the blog post here.
This framework was heavily influenced by the following:
ANTHROPIC_API_KEY): Required to call Claude. All model calls run on Claude Opus 4.8 via the Claude Agent SDK.Clone the Repository
git clone https://github.com/miltonian/principles.git
cd principles
Install Dependencies
npm install
# or
yarn install
Set Up Environment Variables
Create a .env file in the root directory and add your Anthropic API key:
ANTHROPIC_API_KEY=your-anthropic-api-key
Check .env in .gitignore
Ensure .env is in .gitignore to avoid committing sensitive data.
Principles takes your goal or problem statement and applies first principles reasoning to identify fundamental truths and minimal subtasks. Through iterative refinement, it ensures these fundamental pieces are stable, aligned, and feasible for a text-based assistant. The final output includes a thoroughly documented set of agents, allowing you to directly generate effective prompts or seamlessly integrate the agents into your solution.
npm run generate-agents "I want to design a multi-agent system using first principles thinking."
This command:
packages/ containing the generated agents and all necessary configurations, complete with comprehensive agent specifications.After generating agents, you can run them against new prompts:
cd packages/<generated-agent-directory>/
npm run run-agents "How should these agents adapt if the project's constraints change?"
The agents respond with results grounded in refined truths and minimal subtasks. The final breakdown includes extensive agent descriptions, enabling you to directly craft prompts for new agents.
ontology.json plus a generic
runtime. At run time, a triage step checks whether your prompt fits the frame
(and answers directly if it doesn't), plans which agents to run, executes them
in dependency levels over a shared blackboard, judges every output against a
rubric derived from the truths, and synthesizes the final answer.The final result is a package of agents you can integrate into larger workflows or use as blueprints for generating agent prompts. The in-depth final specifications enable seamless adoption in any downstream application.
The framework uses standardized JSON errors and adheres to strict validation checks. If subtasks or truths are problematic, iterative refinement corrects them before finalization, reducing manual debugging.
Command:
npm run generate-agents "I want to design a multi-agent system using first principles thinking."
Process:
Outcome:
You get a new directory in packages/ containing your agents and their configurations.
Command:
cd packages/<generated-agent-directory>/
npm run run-agents "How should these agents adapt if the project's constraints change?"
Result:
Iterative refinement ensures that the fundamental truths and subtasks aren’t just derived once but revisited until stable. This process guarantees that the final agent set is minimal, accurate, and fully detailed, so you can immediately leverage the final agent descriptions as powerful prompt templates.
First principles drive every step:
The methodologies underpinning the Principles Framework are strongly validated by research studies demonstrating the effectiveness of decomposition-based frameworks. Key findings from these studies provide evidence for the power and utility of the Principles approach:
The Principles Framework's focus on breaking down complex goals into their most fundamental components aligns with results from the TDAG (Dynamic Task Decomposition and Agent Generation) framework:
These results demonstrate the value of modular decomposition and dynamic agent generation, which are cornerstones of the Principles Framework.
Reference: TDAG Framework and ItineraryBench
The iterative and adaptive nature of the Principles Framework is reinforced by studies on modular problem-solving systems:
Reference: Dynamic Role Discovery and Assignment
These studies highlight the effectiveness of dynamic decomposition and iterative problem-solving, which are central to the Principles Framework.
Contributions are welcome. If you have ideas for better heuristics, improved logging, or richer final agent definitions, follow the Contributing guidelines to submit your enhancements.
Principles is released under the MIT License.
TypeScript
98.8%
Python
1.2%
Generate specialized AI agents using first principles thinking.
TypeScript
34
15 commits
updated Jul 6, 2026
Principles is a powerful and flexible framework that enables you to generate specialized AI agents based on a goal or problem statement. By applying first principles thinking, Principles breaks down your goal into its most fundamental truths or components—the smallest, indivisible parts of the problem. It then generates a network of collaborating agents that address each fundamental component. This approach allows you to create highly effective AI solutions tailored to your specific needs, enabling you to process subsequent prompts with greater accuracy and efficiency than general-purpose language models.
Note: This framework was designed as an experiment, and the code may require refining in some places.
For a more exhaustive discussion of the Principles Framework, explore the blog post here.
This framework was heavily influenced by the following:
ANTHROPIC_API_KEY): Required to call Claude. All model calls run on Claude Opus 4.8 via the Claude Agent SDK.Clone the Repository
git clone https://github.com/miltonian/principles.git
cd principles
Install Dependencies
npm install
# or
yarn install
Set Up Environment Variables
Create a .env file in the root directory and add your Anthropic API key:
ANTHROPIC_API_KEY=your-anthropic-api-key
Check .env in .gitignore
Ensure .env is in .gitignore to avoid committing sensitive data.
Principles takes your goal or problem statement and applies first principles reasoning to identify fundamental truths and minimal subtasks. Through iterative refinement, it ensures these fundamental pieces are stable, aligned, and feasible for a text-based assistant. The final output includes a thoroughly documented set of agents, allowing you to directly generate effective prompts or seamlessly integrate the agents into your solution.
npm run generate-agents "I want to design a multi-agent system using first principles thinking."
This command:
packages/ containing the generated agents and all necessary configurations, complete with comprehensive agent specifications.After generating agents, you can run them against new prompts:
cd packages/<generated-agent-directory>/
npm run run-agents "How should these agents adapt if the project's constraints change?"
The agents respond with results grounded in refined truths and minimal subtasks. The final breakdown includes extensive agent descriptions, enabling you to directly craft prompts for new agents.
ontology.json plus a generic
runtime. At run time, a triage step checks whether your prompt fits the frame
(and answers directly if it doesn't), plans which agents to run, executes them
in dependency levels over a shared blackboard, judges every output against a
rubric derived from the truths, and synthesizes the final answer.The final result is a package of agents you can integrate into larger workflows or use as blueprints for generating agent prompts. The in-depth final specifications enable seamless adoption in any downstream application.
The framework uses standardized JSON errors and adheres to strict validation checks. If subtasks or truths are problematic, iterative refinement corrects them before finalization, reducing manual debugging.
Command:
npm run generate-agents "I want to design a multi-agent system using first principles thinking."
Process:
Outcome:
You get a new directory in packages/ containing your agents and their configurations.
Command:
cd packages/<generated-agent-directory>/
npm run run-agents "How should these agents adapt if the project's constraints change?"
Result:
Iterative refinement ensures that the fundamental truths and subtasks aren’t just derived once but revisited until stable. This process guarantees that the final agent set is minimal, accurate, and fully detailed, so you can immediately leverage the final agent descriptions as powerful prompt templates.
First principles drive every step:
The methodologies underpinning the Principles Framework are strongly validated by research studies demonstrating the effectiveness of decomposition-based frameworks. Key findings from these studies provide evidence for the power and utility of the Principles approach:
The Principles Framework's focus on breaking down complex goals into their most fundamental components aligns with results from the TDAG (Dynamic Task Decomposition and Agent Generation) framework:
These results demonstrate the value of modular decomposition and dynamic agent generation, which are cornerstones of the Principles Framework.
Reference: TDAG Framework and ItineraryBench
The iterative and adaptive nature of the Principles Framework is reinforced by studies on modular problem-solving systems:
Reference: Dynamic Role Discovery and Assignment
These studies highlight the effectiveness of dynamic decomposition and iterative problem-solving, which are central to the Principles Framework.
Contributions are welcome. If you have ideas for better heuristics, improved logging, or richer final agent definitions, follow the Contributing guidelines to submit your enhancements.
Principles is released under the MIT License.
TypeScript
98.8%
Python
1.2%