Skip to content

Commit 02ebd71

Browse files
Merge pull request #24 from 0xGondarxyz/magic-docs-fullFlow-revised
revise the Magic docs, delete the old sections, add sections followi…
2 parents b2d6bc7 + 90a88c4 commit 02ebd71

1 file changed

Lines changed: 239 additions & 36 deletions

File tree

src/using_recon/recon_magic.md

Lines changed: 239 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Magic Jobs commit changes after each workflow step. This provides:
4646
- **Real-time progress**: Changes are pushed to GitHub as they happen
4747

4848
In the job detail page, you can:
49+
4950
- View the workflow progress with step-by-step completion status
5051
- Click on commit hashes to view them directly on GitHub
5152
- Expand each step to see which files were changed
@@ -71,64 +72,266 @@ The "Stop requested" badge will appear once your request is received. The job wi
7172

7273
---
7374

74-
*See below for workflow-specific tutorials and details on each Magic Job type.*
75+
_See below for workflow-specific tutorials and details on each Magic Job type._
7576

7677
## V2 Workflows
7778

78-
The V2 AI agents are designed to be used in sequence. You can start from code as long as it's somewhat valid. Each step builds on the previous one:
79+
## Scout + Setup + Properties + Coverage
80+
81+
The complete end-to-end workflow that takes you from raw code to a fully functional fuzzing suite with properties.
82+
83+
### Requirements
84+
85+
None. Works with any Solidity repository.
86+
87+
### What does it do?
88+
89+
- Analyzes your codebase to understand the system architecture
90+
- Makes setup decisions including fuzzing suite architecture, what to test, and what to exclude
91+
- Scaffolds the suite and creates the `Setup.sol` contract
92+
- Generates target functions and creates foundry test wrappers
93+
- Writes properties in `Properties.sol`
94+
- Sorts sequences by coverage impact
95+
96+
### What is the expected outcome?
97+
98+
- A complete fuzzing suite ready to run
99+
- `FUZZING_SETUP_COMPLETE.md` explaining what was done
100+
- `Properties.sol` populated with properties ready to break the protocol
101+
- Recommendations on where to focus your fuzzing efforts
102+
- Documentation in the `magic` folder including additional properties to consider
103+
104+
### When to use it?
105+
106+
Use this when starting from scratch and want the AI to handle everything: setup, coverage, and property writing.
107+
108+
## Scout + Setup + Coverage
109+
110+
A streamlined workflow that sets up your fuzzing suite optimized for coverage, without writing properties.
111+
112+
### Requirements
113+
114+
None. Works with any Solidity repository.
115+
116+
### What does it do?
117+
118+
- Analyzes your codebase and makes setup decisions
119+
- Scaffolds the project and implements `Setup.sol`
120+
- Identifies target functions and creates handlers
121+
- Creates clamped handlers for better fuzzing
122+
- Optimizes for coverage
123+
124+
### What is the expected outcome?
125+
126+
- A working fuzzing suite targeted for coverage
127+
- `Setup.sol` with documented setup decisions
128+
- Handler functions ready for fuzzing
129+
130+
You do **not** get properties written. You'll need to write those yourself or run a properties workflow afterward.
131+
132+
### When to use it?
133+
134+
Use this when you want AI help with setup and coverage but prefer to write your own properties, or when you plan to run a separate properties workflow later.
135+
136+
## Setup + Properties + Coverage
137+
138+
A comprehensive workflow for scaffolded projects that handles setup, property writing, and coverage optimization.
139+
140+
### Requirements
141+
142+
Requires a scaffolded project with valid compilation.
143+
144+
### What does it do?
145+
146+
- Analyzes your codebase to understand the system architecture
147+
- Creates a setup based on the code and populates `Setup.sol`
148+
- Writes clamped handlers for coverage generation
149+
- Creates target function wrappers in `CryticToFoundry.sol` and runs initial Echidna fuzzing campaign for corpus generation
150+
- Writes extensive properties that are expected to hold true in the system
151+
152+
### What is the expected outcome?
153+
154+
- A populated `Setup.sol` with setup decisions
155+
- Clamped handlers written to reach maximum coverage
156+
- Properties written for stress testing the protocol
157+
- Setup decision notes in the `magic` folder
158+
- Properties decisions documented in the `magic` folder
159+
160+
### When to use it?
161+
162+
Use this when you have already scaffolded your project and want Magic to handle setup, write properties, and optimize coverage for you.
163+
164+
## Setup + Coverage
165+
166+
A focused workflow for scaffolded projects that creates setup and optimizes coverage without writing properties.
167+
168+
### Requirements
169+
170+
Requires a scaffolded project with valid compilation.
171+
172+
### What does it do?
173+
174+
- Analyzes your contracts to understand the system
175+
- Creates `Setup.sol` with setup decisions
176+
- Documents decisions in `magic/setup-decisions.json` and `magic/setup-notes.md`
177+
- Creates comprehensive target functions including `AdminTargets` and `ManagerTargets`
178+
- Populates `CryticToFoundry.sol` with functions for validation
179+
180+
### What is the expected outcome?
181+
182+
- A configured `Setup.sol` with documented setup decisions
183+
- Comprehensive target functions for ensuring high coverage
184+
- Setup notes and documentation in the `magic` folder
185+
186+
You do **not** get properties written. You'll need to write those yourself or run a properties workflow afterward.
187+
188+
### When to use it?
189+
190+
Use this when you have a scaffolded project and want to create setup and achieve high coverage quickly, but prefer to write the properties yourself.
191+
192+
## Coverage V2
193+
194+
Workflow name in the Magic dashboard: `workflow-fuzzing-coverage`
195+
196+
A coverage-focused workflow that creates extensive handlers to maximize fuzzing coverage.
197+
198+
### Requirements
199+
200+
Requires a scaffolded project with valid compilation.
201+
202+
### What does it do?
203+
204+
- Makes setup decisions and populates `Setup.sol`
205+
- Creates comprehensive coverage with clamped handlers and shortcuts
206+
- Generates `DoomsdayTargets` for edge case testing
207+
- Generates `AdminTargets` for privileged function testing
208+
- Iteratively improves handlers until coverage targets are met
209+
210+
### What is the expected outcome?
211+
212+
- Extensive test coverage through well-crafted handlers
213+
- Clamped handlers with meaningful values
214+
- Shortcut handlers to help the fuzzer reach coverage faster
215+
216+
You get coverage optimization only. No properties are written.
217+
218+
### When to use it?
219+
220+
Use this when you already have a scaffolded project and want to maximize coverage before writing properties.
221+
222+
## Implement Properties from Setup
223+
224+
Workflow name: `workflow-properties-full`
225+
226+
A fast workflow that writes properties based on your existing setup.
227+
228+
### Requirements
229+
230+
Requires an existing setup in place (`Setup.sol` must exist).
231+
232+
### What does it do?
233+
234+
- Populates `Properties.sol` with comprehensive properties for your system
235+
- Generates `BeforeAfter.sol` with state tracking
236+
- Creates detailed documentation on properties organized by property classes
237+
238+
### What is the expected outcome?
239+
240+
- `Properties.sol` populated with properties that should hold in your system
241+
- Populated `BeforeAfter.sol` for state comparison
242+
- Documentation in the `magic` folder showing properties across different categories
243+
244+
### When to use it?
245+
246+
Use this when you already have coverage in place and want help writing properties. This is faster than full workflows since it focuses solely on property generation.
247+
248+
## Implement Properties from Setup (Opus)
249+
250+
Same as Implement Properties from Setup but uses the Claude Opus model for higher quality output.
251+
252+
### Requirements
253+
254+
Requires an existing setup in place (`Setup.sol` must exist).
255+
256+
### What does it do?
257+
258+
- Uses the most advanced Opus model to analyze your system
259+
- Creates comprehensive properties with deeper analysis
260+
- Generates extensive documentation on choices and reasoning
261+
262+
### What is the expected outcome?
263+
264+
- `Properties.sol` with high-quality properties generated by Opus
265+
- Populated `BeforeAfter.sol` for state comparison
266+
- Extensive documentation in the `magic` folder explaining the AI's reasoning and property choices
267+
268+
### When to use it?
269+
270+
Use this when you want the best possible help writing properties and are willing to wait a bit longer for higher quality output.
271+
272+
## Identify Invariants (V1)
273+
274+
A lightweight analysis workflow that identifies invariants without modifying your codebase.
275+
276+
### Requirements
79277

80-
### Scout V2 (`workflow-fuzzing-scouting`)
278+
None. Works with any Solidity repository.
81279

82-
Give Scout V2 any repository and it will essentially use the [Recon Extension](../free_recon_tools/recon_extension.md) for you. It analyzes your codebase and identifies invariants in your smart contracts.
280+
### What does it do?
83281

84-
**Input:** Any GitHub repository
282+
- Analyzes your smart contracts for potential invariants
283+
- Documents a comprehensive list of properties that could be tested
284+
- Identifies contract dependencies
285+
- Lists discarded properties with reasoning
85286

86-
### Setup V2 (`workflow-fuzzing-setup`)
287+
This workflow does **not** scaffold, does **not** create `Setup.sol`, and does **not** write `Properties.sol`.
87288

88-
Setup V2 fixes compilation issues and creates a professional fuzzing setup so your fuzzing campaign will be useful.
289+
### What is the expected outcome?
89290

90-
**Input:** Repository (can have compilation issues)
91-
**Output:** Fixed compilation + professional fuzzing setup
291+
- Documentation in the `magic` folder containing:
292+
- A comprehensive list of invariants and properties to test
293+
- Contract dependency analysis
294+
- Discarded properties with explanations
92295

93-
### Coverage V2 (`workflow-fuzzing-coverage`)
296+
### When to use it?
94297

95-
Coverage V2 requires valid compilation and a valid setup. It then works to push your code toward better coverage.
298+
Use this when you want to understand which invariants might be valuable for your system before committing to a full setup. Ideal if you prefer to write the properties yourself.
96299

97-
**Input:** Repository with valid compilation and valid setup
98-
**Output:** Improved coverage for your fuzzing campaign
300+
## Find Bugs (V1)
99301

100-
**How it works:** Coverage V2 runs a multi-step workflow that:
101-
1. Extracts target functions from your fuzzing suite
102-
2. Analyzes build artifacts to identify all functions that need coverage
103-
3. Creates clamped handlers with meaningful values for better fuzzing
104-
4. Creates shortcut handlers to help the fuzzer reach coverage faster
105-
5. Runs fuzzing and evaluates coverage
106-
6. Iteratively improves handlers until coverage targets are met
302+
Workflow name: AI Powered Audit
107303

108-
Each step automatically commits changes to git, so you can track exactly what the AI modified.
304+
_Experimental._
109305

110-
## Using the Workflows
306+
An AI-powered audit workflow that attempts to find bugs in your smart contracts.
111307

112-
1. **Start with Scout V2** to analyze your repository and identify invariants
113-
2. **Run Setup V2** to fix any compilation issues and establish a solid fuzzing foundation
114-
3. **Use Coverage V2** to maximize your test coverage
308+
### Requirements
115309

116-
Automatic chaining of these workflows is coming soon. Currently, running them separately provides better reliability.
310+
Any GitHub repository with Solidity smart contracts.
117311

118-
## V1 Workflows
312+
### What does it do?
119313

120-
These are simpler, single-prompt workflows that run a sequence of agent phases:
314+
- Performs automated security analysis
315+
- Attempts to identify vulnerabilities and bugs
121316

122-
### Identify Invariants (`properties-0`)
317+
### What is the expected outcome?
123318

124-
Analyzes your smart contracts and identifies potential invariants. Extract meaningful properties from your codebase.
319+
- An audit report highlighting potential issues
125320

126-
**Input:** Any GitHub repository with smart contracts
127-
**Output:** A document specifying a ton of properties for your system.
321+
### When to use it?
128322

129-
### Find Bugs (`audit-naive-0`) - Experimental
323+
Use this for a quick automated security check. Note that this is experimental and results may vary.
130324

131-
AI-powered audit workflow that attempts to find bugs in your smart contracts. P automated security analysis.
325+
## Choosing the Right Workflow
132326

133-
**Input:** Any GitHub repository with smart contracts
134-
**Note:** An audit report.
327+
| Workflow | Setup | Coverage | Properties | Best For |
328+
| ------------------------------------- | ------- | -------- | ---------- | ------------------------------------------------------------- |
329+
| Scout + Setup + Properties + Coverage | Yes | Yes | Yes | Starting from scratch, want everything automated |
330+
| Scout + Setup + Coverage | Yes | Yes | No | Want AI setup but prefer writing own properties |
331+
| Setup + Properties + Coverage | Yes | Yes | Yes | Have scaffolded project, want setup, coverage, and properties |
332+
| Setup + Coverage | Yes | Yes | No | Have scaffolded project, want setup and coverage only |
333+
| Coverage V2 | Partial | Yes | No | Already have setup, need better coverage |
334+
| Implement Properties from Setup | No | No | Yes | Have coverage, need help with properties |
335+
| Implement Properties (Opus) | No | No | Yes | Want highest quality property generation |
336+
| Identify Invariants (V1) | No | No | Docs only | Research phase, want to understand invariants first |
337+
| Find Bugs (V1) | No | No | No | Quick automated security audit (experimental) |

0 commit comments

Comments
 (0)