Principles
These are the rules YACT is built on. Some are enforced by the tool; others are habits it only supports. Each says which.
AI in the loop, not human in the loop
In agentic development, the agent runs the loop and the person steps in when asked. YACT turns that around. The person runs the loop: writes the prompt, chooses the context, makes every decision, checks the result. The model does a well-defined job at two points in it: it writes the plan, and it writes the code. A design decision.
A prompt is a program
When you ask a model to change code, the prompt is a program in a very high-level language, and the model compiles it into files. A program can be checked before it runs. A prompt can be wrong in two ways that can be found without running anything:
- It is incomplete. It refers to code the model cannot see: a type, a caller, a file that was not linked. The plan lists these under Missing context.
- It leaves a decision open. The model then decides without saying so. The plan lists these under Assumptions.
YACT treats both as errors: act will not run until they are resolved. Enforced by the tool.
The check is a lint, not a proof. The model does it during the plan call, so it finds only what the model notices, and an empty Assumptions section does not mean the prompt had none. What it gives is narrower and still useful: gaps show up before any code exists, when fixing one costs a sentence instead of a round of review.
Only a person accepts a decision
The model always writes open boxes, and YACT keeps a tick only if a person ticked the same entry before and its words have not changed. Enforced by the tool.
This is also why YACT does not run unattended. A job that plans and implements with nobody reading would have to tick the boxes itself. A design decision: there is no automation to switch on.
A tick is one keystroke, so the tool cannot make anyone read. It makes each decision visible and records it in the plan.
The plan travels with the change
A resolved plan records four things in one place: the intent in the author's words, the file each step changes, the files the model saw, and the decisions that were accepted. A reviewer with the plan compares the change with what was asked instead of reconstructing it from the diff. A habit: YACT does not attach the plan anywhere.
Nothing happens out of sight
- One command is one API call. No loop, no retries, no exploring the codebase, no running commands. Enforced by the design.
- Only linked files are sent, plus the index of names when a call asks for it. Enforced.
- A response may only write the files the prompt or plan links. Enforced.
- State lives in plain files: the prompt and plan in
yact-prompt.md, the last response in.yact/temp/buffer.txt. Every call prints the files it sends and its cost. Enforced.
The developer stays in the codebase
Writing a complete prompt and choosing the files requires knowing the code, and doing it keeps that knowledge in use. This is why YACT does not search for context on its own. A design decision, with a cost: see Limitations.
Code is shaped to be understood from a few files
Each call sees only the linked files, and the model writes every changed file back in full. So code has to be understandable from what is visible in one place, and files have to stay small. Sixteen code principles and four defaults describe that code. plan, act, analyze and review all include the same list, from one text file you can edit.
Where code shaped for a model and code shaped for a person disagree, the person wins.
The text below follows the file that the model receives, lightly edited for reading. The file in the repository, systemprompts/include/principles.txt, is the authoritative version.
The sixteen principles
- P1. Searchable names
- Names reveal intent and are unique enough to find with a text search. No generic names (
data,info,utils,helpers,manager,process,handle). No identifiers built from strings at runtime. One name per concept. - P2. Single responsibility
- Each function, type and module has one job and one reason to change.
- P3. No hidden side effects
- A function does what its name and signature say, and nothing else. It does not mutate arguments, globals or shared objects unless that is its stated purpose.
- P4. Command-query separation
- A function either returns information or changes state, not both. Returning an error together with a result is fine.
- P5. Functional core, imperative shell
- Business logic lives in pure functions. File system, network, database, clock, randomness, environment and console output live in a thin outer layer that calls the core.
- P6. Illegal states unrepresentable
- Model states with types that cannot hold invalid combinations: sum types, enums, sealed classes, separate structs, or the closest construct the language offers. Do not use loose strings, booleans that exclude each other, or optional fields that depend on each other.
- P7. Parse, don't validate
- Convert untrusted input (user input, CLI arguments, files, network data, LLM output) into precise types once, at the boundary. Inner code takes those types and does not check them again.
- P8. Explicit over implicit
- Plain calls with visible arguments. No magic decorators, reflection-based wiring, monkey-patching, implicit conversions, hidden global state or behavior that depends on naming conventions.
- P9. Static types
- Type every function signature and data structure the language allows. No
any,interface{}, untyped maps or dicts where a concrete type fits. - P10. Wrapped dependencies
- Third-party libraries and external services are called through a thin interface the project owns, not from all over the code.
- P11. Deep modules
- A module has a small, simple interface that hides substantial work. Avoid shallow pass-through layers.
- P12. Shallow structure
- Composition over inheritance, early returns over nesting, short call chains and few layers of indirection.
- P13. Simple and conventional
- Build only what the task needs now. Readable over clever. Use the mainstream idioms of the language and of the codebase.
- P14. Comments explain why
- Names and types say what the code does. Comments state intent, business rules, invariants, constraints and non-obvious decisions. No comments that restate the code.
- P15. Tests
- Logic is covered by fast, independent, deterministic tests that run with one command. Pure functions are tested directly, without mocks.
- P16. Consistency
- Formatting, naming and structure match the surrounding code.
Four defaults
Developers disagree about some trade-offs. For four of them, the principles state a default so that the model does not choose a different answer on every call.
- D1. Duplication
- Tolerate small duplication until the right abstraction is clear. Do not merge code that only looks alike. Do remove duplication of one business rule.
- D2. Function size
- Keep related logic together in one readable function rather than scattering it across many tiny ones. Split a function when it has more than one responsibility, not when it reaches a line count.
- D3. Organization
- Follow the existing layout of the codebase. When a new module is needed, keep the code of one feature together.
- D4. File size
- Keep source files under about 200 lines and split them before 300, because every change rewrites the whole file. Split along responsibilities inside the same package or module and keep its public interface unchanged, rather than creating new modules or shallow wrappers.
How YACT applies them
Four of the six commands include the principles, so code is planned, written and reviewed by the same rules.
plan- Designs the steps so that the resulting code follows the principles. Where a principle explains a design decision, the step names it, for example "(P7: parse once at the boundary)".
plandoes not add steps that only refactor, wrap or rename code the goal does not need. act- Applies the principles to every function and type it writes or changes. It leaves all other code unchanged, even code that breaks a principle. When it extends existing code, it follows the pattern already used there.
review- Reports a violation only when it makes the changed code harder to change or easier to break, and names the principle.
analyze- Checks the files you link against all the principles, or against the ones you name, and reports what it finds. It changes nothing.
The plan has priority. If a plan and a principle disagree, act follows the plan. The principles decide only what the plan leaves open.
The principles shape how a goal is reached. They do not change the goal: YACT does not refactor your code because it breaks a principle. If you want that, ask for it in a prompt.
Changing them
The principles are one text file on your machine:
~/.yact/systemprompts/include/principles.txt
Edit it to match your team's rules. The change applies to plan, act, review and analyze from the next call. Keep the identifiers (P1, D4) stable if you can, because plans and reviews refer to them.
Keep a copy of your version. Running y download prompt for one of those four commands downloads the original file again and overwrites your edits.
Some principles assume a statically typed language (P6, P9). In a dynamically typed codebase, the model applies them as far as the language allows, and you may want to reword them.
New code and legacy code
YACT is easy to introduce where the code already follows these principles, or where there is no code yet. On a new project, plan and act follow the principles from the first file.
It is hard to introduce on a legacy codebase with very large files:
- Every step rewrites a whole file. For a file of several thousand lines, that is slow and expensive, and the response can reach the output limit.
- Tangled code needs a lot of context. The plan lists more missing context, and each step links more files.
actdoes not refactor code that the prompt did not mention, so the code does not get cleaner as a side effect of other changes.
YACT warns before a call about every linked file over 300 lines. To see how far a part of your codebase is from the principles, link its files and run y analyze.