agentic development
Twig's AI isn't just a chatbot - it's an agent that can take actions in your development environment. This page explains what that means and how to work with it effectively.
what makes an agent different
Traditional AI coding assistants work in a request-response pattern:
- You ask a question
- The AI suggests code
- You copy and paste it
Twig's agent works differently:
- You describe what you want to accomplish
- The agent plans how to achieve it
- The agent executes the plan (with your approval)
- You review the results
The agent can read files, search code, run commands, and edit multiple files - all in service of completing your request.
agent capabilities
The agent can:
- read and search code - understand your entire codebase
- edit files - make precise changes across multiple files
- run commands - execute shell commands, run tests, build projects
- access posthog - query your analytics data (when connected)
- reason about problems - break complex tasks into steps
you stay in control
Despite its capabilities, the agent doesn't act without oversight:
- edits require approval - you see proposed changes before they're applied
- commands are shown - you know what's being executed
- you can intervene - stop, modify, or redirect at any time
Think of it as a very capable assistant that checks with you before making important decisions.
working with the agent effectively
be specific about goals
Instead of:
fix the bug
Try:
the login form submits twice when the button is clicked quickly.
add debouncing to prevent duplicate submissions.
provide context
The agent can read your code, but it can't read your mind:
we use react-query for data fetching throughout the app.
add a mutation for updating user preferences using the same pattern.
let it explore
For complex tasks, let the agent investigate first:
explore how authentication works in this codebase and
explain the flow before making any changes
iterate on results
If the first attempt isn't quite right, provide feedback:
this is close, but we should also handle the loading state.
update the component to show a spinner while the request is in progress.
agent architecture
Twig's agent is built on Anthropic's Claude Agent SDK, which provides the harness for agentic capabilities:
- Tool use for interacting with your environment
- Context management for long conversations
- Safety guardrails to prevent harmful actions
You can configure which language model the agent uses, giving you flexibility to choose the right model for your needs.