Skip to content

Commit 5618b15

Browse files
committed
docs: document ideas queue feature
Update README.md: - Add Ideas Queue to features list - Document .opencoder/ideas/ directory in structure - Add comprehensive Ideas Queue section with: - Quick start example - How it works (workflow, selection, fallback) - Selection criteria (simplicity, dependencies, priority) - Example log output - Tips for writing effective ideas - Update tips section to mention ideas feature Update AGENTS.md: - Add ideas.zig to source code structure - Document Ideas Queue Feature section including: - How the system works internally - Key files involved in implementation - Selection criteria for AI - Example idea file format - Testing instructions - Implementation notes (precedence, cleanup, memory safety) Provides both user-facing (README) and developer-facing (AGENTS) documentation. Signed-off-by: leocavalcante <[email protected]>
1 parent c45a9e7 commit 5618b15

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

AGENTS.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ src/
8282
fs.zig # File system utilities
8383
logger.zig # Logging infrastructure
8484
plan.zig # Plan parsing, validation, markdown handling
85+
ideas.zig # Ideas queue management, selection logic
8586
executor.zig # OpenCode CLI process execution
8687
evaluator.zig # Plan completion evaluation
8788
loop.zig # Main autonomous execution loop
@@ -260,6 +261,71 @@ pub const Phase = enum {
260261
};
261262
```
262263

264+
## Ideas Queue Feature
265+
266+
Opencoder includes an **ideas queue system** that allows users to provide specific tasks for the autonomous loop to work on. This is implemented in `src/ideas.zig`.
267+
268+
### How It Works
269+
270+
1. **Ideas Directory**: `.opencoder/ideas/` - Users place `.md` files here
271+
2. **Planning Integration**: Before each planning cycle, `loop.zig` checks for ideas
272+
3. **Selection Logic**:
273+
- **1 idea**: Used directly (no AI selection call)
274+
- **2+ ideas**: AI evaluates all and picks the simplest/quick-win considering dependencies
275+
4. **Execution**: Selected idea is deleted, plan is created from idea content
276+
5. **Fallback**: When ideas are exhausted, returns to autonomous planning
277+
278+
### Key Files
279+
280+
- **`ideas.zig`**: Core module with `Idea` struct, `loadAllIdeas()`, `formatIdeasForSelection()`
281+
- **`plan.zig`**: Added `generateIdeaSelectionPrompt()` and `generateIdeaPlanningPrompt()`
282+
- **`executor.zig`**: Added `runIdeaSelection()` and `runIdeaPlanning()` methods
283+
- **`loop.zig`**: Integrated ideas check before planning phase
284+
- **`fs.zig`**: Added `ideas_dir` to `Paths` struct
285+
286+
### Selection Criteria
287+
288+
The AI evaluates ideas based on:
289+
- **Simplicity**: Quick wins are prioritized
290+
- **Dependencies**: Prerequisites selected before dependents
291+
- **Priority order**: Bug fixes > Small features > Docs > Refactoring > Large features
292+
293+
### Example Idea File
294+
295+
```markdown
296+
# Fix Login Timeout Bug
297+
298+
Users are being logged out after 5 minutes instead of the configured 30 minutes.
299+
300+
Steps:
301+
1. Check session configuration
302+
2. Update timeout value in config
303+
3. Test with various session durations
304+
```
305+
306+
### Testing Ideas Feature
307+
308+
```bash
309+
# Test ideas.zig module
310+
zig test src/ideas.zig
311+
312+
# Test plan.zig with new prompt functions
313+
zig test src/plan.zig
314+
315+
# Test full integration
316+
mkdir -p test-project/.opencoder/ideas
317+
echo "Test idea content" > test-project/.opencoder/ideas/test.md
318+
./zig-out/bin/opencoder --provider opencode -p test-project
319+
```
320+
321+
### Implementation Notes
322+
323+
- Ideas take **full precedence** over user hints
324+
- Idea files are **deleted before planning** (prevents retry loops)
325+
- Empty/invalid ideas are **automatically cleaned up**
326+
- No naming conventions required - any `.md` file works
327+
- **Memory safe** - All allocations properly tracked and freed
328+
263329
## CI Pipeline
264330

265331
The GitHub Actions CI (`.github/workflows/ci.yml`) runs:

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
## Features
88

99
- **Autonomous Development Loop** - Continuously plans, executes, and evaluates without stopping
10+
- **Ideas Queue** - Drop markdown files in `.opencoder/ideas/` to prioritize specific tasks before autonomous planning
1011
- **Two-Model Architecture** - Uses a high-capability model for planning and a faster model for execution
1112
- **Provider Presets** - Quick setup with GitHub Copilot, Anthropic, OpenAI, or OpenCode backends
1213
- **State Persistence** - Resumes from where it left off after interruptions (JSON format)
@@ -181,6 +182,9 @@ OpenCoder creates a `.opencoder/` directory in your project:
181182
.opencoder/
182183
├── state.json # Current execution state (JSON)
183184
├── current_plan.md # Active task plan
185+
├── ideas/ # Drop .md files here to queue tasks
186+
│ ├── feature-x.md
187+
│ └── bugfix-y.md
184188
├── history/ # Archived completed plans
185189
│ └── plan_YYYYMMDD_HHMMSS_cycleN.md
186190
└── logs/
@@ -222,9 +226,61 @@ Building a secure authentication system for the web application.
222226
Using bcrypt for password hashing, JWT for tokens.
223227
```
224228

229+
## Ideas Queue
230+
231+
Want to direct OpenCoder toward specific tasks? Drop markdown files in `.opencoder/ideas/` and OpenCoder will prioritize them before generating its own plans.
232+
233+
### Quick Start
234+
235+
```bash
236+
# Create an idea
237+
cat > .opencoder/ideas/add-dark-mode.md << 'EOF'
238+
Add dark mode toggle with system preference detection.
239+
EOF
240+
241+
# Run opencoder
242+
opencoder --provider github
243+
```
244+
245+
### How It Works
246+
247+
1. **Before Planning** - OpenCoder checks `.opencoder/ideas/` for `.md` files
248+
2. **Smart Selection**:
249+
- **1 idea**: Uses it directly (no extra API call)
250+
- **2+ ideas**: AI evaluates all and picks the simplest/quick-win, considering dependencies
251+
3. **Execution** - Selected idea is deleted, plan is created specifically for it
252+
4. **Fallback** - When ideas are exhausted, returns to autonomous planning
253+
254+
### Selection Criteria
255+
256+
The AI prioritizes based on:
257+
- **Simplicity** - Quick wins first
258+
- **Dependencies** - If idea B requires idea A, A is selected first
259+
- **Priority order** - Bug fixes > Small features > Docs > Refactoring > Large features
260+
261+
### Example Output
262+
263+
```
264+
[Cycle 5] Found 3 idea(s) in queue
265+
[Cycle 5] Selected idea: fix-login-timeout.md
266+
[Cycle 5] Summary: Fix login timeout issue where users are logged out after 5min
267+
[Cycle 5] Reason: Bug fix with no dependencies, can be completed quickly
268+
[Cycle 5] Planning for idea: fix-login-timeout.md
269+
[Cycle 5] Plan created with 3 tasks
270+
```
271+
272+
### Tips for Ideas
273+
274+
- **Be specific** - The more detailed the idea, the better the plan
275+
- **One idea per file** - Keep ideas focused and atomic
276+
- **Mention dependencies** - Explicitly state if an idea depends on another
277+
- **No naming convention** - Any `.md` filename works
278+
- **Auto-cleanup** - Empty/invalid ideas are automatically deleted
279+
225280
## Tips
226281

227282
- **Start with a clear hint** - The more specific your instruction, the better the initial plan
283+
- **Use ideas for focus** - Drop task files in `.opencoder/ideas/` to direct development
228284
- **Let it run** - OpenCoder is designed to run continuously; trust the loop
229285
- **Check the logs** - Detailed logs are in `.opencoder/logs/` if something goes wrong
230286
- **Review history** - Completed plans are archived in `.opencoder/history/`

0 commit comments

Comments
 (0)