Adopt / Getting Started
Getting Started
Build your first agentic layer and run your first workflow. Three prompt templates, one quality gate, one manual run.
You're building your workflow, not installing one. This guide walks you through creating your agentic layer and running it manually. The reference example shows a complete implementation you can study, fork, or use as inspiration. Every team's workflow is different, and that's by design.
What you'll build
3 prompt templates + 1 quality gate
What you'll learn
The Plan, Build, Test loop: the core of every agentic workflow
Time estimate
1.5-2 hours for first full run (setup + one manual workflow execution)
Prerequisites
A Codebase
Any language, any size, any age. You need at least one existing test to validate the quality gate. If you have no tests, that's fine. Your first agentic task can be "add a test."
An AI Agent
A code-editing agent with these capabilities:
- File read/write: can read and create files in your repository
- Shell execution: can run commands (tests, git, linters)
- Search: can search file contents and directory structures
Examples: Kiro, Claude Code, Cursor, Cline, Windsurf, or any agent with tool use that includes the above.
Optional but recommended: subagent spawning for multi-agent patterns described in the advanced workflow phases.
Git
A version control system (Git is assumed throughout, but the pattern applies to any VCS). Work on a branch. Never directly on main.
Create the directory structure
Your agentic layer needs two directories. Run this from your project root:
mkdir -p agentic-layer/{prompts,gates}
prompts/ holds your phase prompt templates. gates/ holds your quality gate criteria. You can add tools/, commands/, and workflow.yaml later.
agentic-layer/
+-- prompts/ # One template per workflow phase
| +-- plan.md # You'll write this in Step 2
| +-- build.md # You'll write this in Step 3
+-- gates/ # Quality criteria
+-- test-pass.md # You'll write this in Step 4
Write your Plan template
The Plan template tells your agent how to research and plan before writing any code. This is the first template to get right because it addresses the most common agent behavior: starting to build before fully understanding the problem.
Copy this entire file into agentic-layer/prompts/plan.md:
# Plan Phase -- Software Architect
## Role
You are a Software Architect. Research the codebase
and produce a detailed implementation plan.
## Context
Issue: ${issue_description}
Type: ${issue_type}
## Constraints
- Read-only. Do not modify any files.
- Research before planning. Read relevant source files,
tests, and documentation before proposing changes.
- Reference specific file:line locations.
- Do NOT plan changes beyond the stated issue.
## Output
1. Summary of changes (2-3 sentences)
2. Files to modify (with line numbers)
3. Files to create (if any)
4. What we are NOT doing (anti-scope-creep)
5. Test strategy (what tests prove this works)
Here's what each pattern does:
- Role assignment gives the agent a persona with clear boundaries. A "Software Architect" researches; it doesn't build.
- Template variables like
${issue_description}and${issue_type}get replaced with real values when you run the workflow. - Read-only constraint prevents the agent from building during planning. The read-only constraint keeps the agent in research mode during planning, preventing premature implementation.
- Anti-scope-creep explicitly states what is out of scope. Without this, agents love to "improve" things you didn't ask for.
- Structured output creates machine-readable sections that the Build phase can consume. This is artifact chaining.
Save this as agentic-layer/prompts/plan.md. You will feed this to your agent in Step 5.
Write your Build template
The Build template tells your agent how to implement the plan. Notice it references ${plan_artifact}. This is artifact chaining, where the output of one phase becomes the input of the next. The Plan output flows directly into Build.
Copy this into agentic-layer/prompts/build.md:
# Build Phase -- Software Engineer
## Role
You are a Software Engineer. Implement the plan
exactly as specified.
## Context
Plan: ${plan_artifact}
Issue: ${issue_description}
## Constraints
- Follow the plan. Do not add features, refactor
unrelated code, or deviate from the spec.
- Write tests FIRST, then implementation.
- Only modify files listed in the plan.
- Make atomic, focused changes.
## Output
1. Tests written (file paths)
2. Implementation changes (file paths)
3. Commands to run tests
4. Any assumptions or deviations from plan (explain why)
- Artifact chaining:
${plan_artifact}links Build to the Plan output. The agent doesn't start from scratch; it starts from the plan. - TDD-first: tests before implementation. The tests become the contract that every later phase validates against. This is a core framework principle.
- Scope lock: only files listed in the plan. No improvising, no "while I'm here" refactors.
Save this as agentic-layer/prompts/build.md.
Write your first quality gate
A quality gate, meaning pass/fail criteria that must be met before a phase completes, is your safety net. Your first gate is simple: do the tests pass?
Copy this into agentic-layer/gates/test-pass.md:
# Test Pass Gate
## Criteria
- All existing tests pass (zero failures)
- All new tests written by the Build phase pass
- No test was deleted or skipped to achieve a pass
## Pass
All criteria met. Proceed to next phase.
## Fail
One or more criteria not met.
Action: Feed test output + build template back to the
agent for a retry. Maximum 3 retries before escalating
to human.
Notice the Fail section defines what happens next. This is the beginning of a self-healing feedback loop. Instead of stopping on failure, the workflow retries with context about what went wrong.
Save this as agentic-layer/gates/test-pass.md. This is your safety net.
Run your first workflow, manually
Now you'll run the Plan → Build → Test loop by hand. Pick a small, real issue from your project: a bug fix, a minor feature, or a simple task. Something you'd normally spend 30 minutes on.
Plan
- Give your agent the Plan template (
agentic-layer/prompts/plan.md) - Replace
${issue_description}with a real issue from your project - Replace
${issue_type}with the type:bug,feature,task, orpatch - Let the agent research your codebase and produce a plan
- Read the plan. Does it make sense? Does it reference real files and line numbers?
Build
- Give your agent the Build template (
agentic-layer/prompts/build.md) - Replace
${plan_artifact}with the plan output from step 5a - Replace
${issue_description}with the same issue description - Let the agent write tests first, then implementation
Test (apply the gate)
- Run the test commands the agent provided in its Build output
- Check the gate criteria from
agentic-layer/gates/test-pass.md - If PASS: You're done. Move to the success section below.
- If FAIL: Give the agent the test output along with the Build template. Tell it: "Tests failed. Here are the results. Fix the implementation following the build template." This is the self-healing loop. Retry up to 3 times.
You just ran your first workflow
You completed the Plan → Build → Test loop manually. That's your minimum viable agentic layer: three templates, one gate, one loop. Everything else builds from here.
What's next
Add more phases
Review, Document, Deploy. Expand your 3-phase loop into the full 7-phase workflow.
Configure self-healing loops
automate the retry loop you just ran manually. Set limits, escalation rules, and automated triggering.
Customize for your stack
add language-specific constraints, team conventions, and project context to your templates.
Increase autonomy
move from L1 (manual) to L2 (supervised) and beyond. See the readiness criteria for each maturity level.
Add the Intent phase
(optional): normalize input quality before planning. Especially useful when requirements come from different sources with varying quality levels.
Common first-time mistakes
"Write good code that follows best practices"
"Follow the plan in ${plan_artifact}. Write tests first. Modify only the files listed."
Why: vague instructions give the agent room to improvise. Specificity is control. The more precise your template, the more predictable the output.
What happens: the agent starts building during planning. It sees a file, thinks "I could fix this," and starts writing code before the plan is complete.
Fix: your Plan template already says "Read-only. Do not modify any files." If your agent tool supports tool permissions, restrict write and execute access during the Plan phase.
Why: The read-only constraint keeps the agent in research mode during planning, preventing premature implementation. Combining them leads to plans that justify whatever the agent already built, instead of the best approach.
What happens: you ask for a bug fix. The agent refactors three files, adds a feature, and updates the README. Your diff is 400 lines instead of 15.
Fix: two guards working together: the Plan template's "Do NOT plan changes beyond the stated issue" constraint, plus the "What we are NOT doing" output section. Together, they scope-lock both the plan and the implementation.
Why: agents are eager to help. Without explicit boundaries, they optimize for thoroughness instead of focus. Scope creep is a common agentic failure mode after hallucination.