summaryrefslogtreecommitdiff
path: root/Omni/Jr.hs
AgeCommit message (Collapse)Author
7 dayst-247: Add Provider abstraction for multi-backend LLM supportBen Sima
- Create Omni/Agent/Provider.hs with unified Provider interface - Support OpenRouter (cloud), Ollama (local), Amp (subprocess stub) - Add runAgentWithProvider to Engine.hs for Provider-based execution - Add EngineType to Core.hs (EngineOpenRouter, EngineOllama, EngineAmp) - Add --engine flag to 'jr work' command - Worker.hs dispatches to appropriate provider based on engine type Usage: jr work <task-id> # OpenRouter (default) jr work <task-id> --engine=ollama # Local Ollama jr work <task-id> --engine=amp # Amp CLI (stub)
2025-12-02jr: add 'prompt' command to inspect agent system promptBen Sima
jr prompt <task-id> constructs and prints the full system prompt that would be sent to the agent, including: - Agent configuration (model, cost budget) - Base instructions - AGENTS.md content - Relevant facts from knowledge base - Retry/progress context if applicable Useful for debugging agent behavior and token usage.
2025-12-01Add actor tracking for status changes and use unified timelineBen Sima
- updateTaskStatusWithActor logs status_change events to agent_events - Worker uses Junior actor for status changes - Jr review uses System/Human actors appropriately - CLI task update uses Human actor - Remove task_activity table schema (migrated to agent_events) - addComment now inserts into agent_events with event_type='comment' Task-Id: t-213
2025-12-01Add author field to task comments (Human vs Junior)Ben Sima
Comments now track whether they were made by a Human or by Junior (the agent). The CommentAuthor type is stored in the database and displayed in the web UI with styled badges. Task-Id: t-201
2025-12-01Replace llm CLI with Engine.chat in Jr.hsBen Sima
Perfect! All tests pass. Let me create a summary of the changes made: I've successfully replaced the `llm` CLI calls with `Engine.chat` in Jr. 1. **`addCompletionSummary` function (lines 604-624)**: - Removed `Process.readProcessWithExitCode "llm" []` call - Added OPENROUTER_API_KEY environment variable check - Replaced with `Engine.chat` using the same pattern as `generateEpic - Proper error handling for missing API key and API failures 2. **`extractFacts` function (lines 658-680)**: - Removed `Process.readProcessWithExitCode "llm" ["-s", ...]` call - Added OPENROUTER_API_KEY environment variable check - Replaced with `Engine.chat` using the same pattern as `generateEpic - Proper error handling for missing API key and API failures 3. **Dependency cleanup**: - Removed `-- : run llm` from the header (line 12) since we no longer - Both functions now use the OpenRouter API via `Engine.chat` - Graceful degradation when OPENROUTER_API_KEY is not set (warning messa - Consistent error handling pattern matching the existing `generateEpicS - All tests pass successfully - No hlint or ormolu issues The implementation follows the exact pattern shown in the task descripti Task-Id: t-198
2025-12-01Add summary comment when individual task completesBen Sima
Excellent! All linting passes. Let me create a final comprehensive summa Task **t-193.3: Add summary comment when individual task completes** is The feature was **already fully implemented** in the codebase. No code c The `addCompletionSummary` function in `Omni/Jr.hs` (lines 589-617) auto 1. **Gathers commit information** when a task is accepted in review: - Git diff summary via `git show --stat` - Commit message via `git log -1 --format=%B` - List of modified files via `git diff-tree` 2. **Generates an LLM summary** using the `llm` CLI tool: - Passes task ID, commit message, files, and diff to the LLM - Requests a 2-4 sentence professional summary - Includes what was accomplished and key files modified 3. **Adds the summary as a task comment** using `TaskCore.addComment`: - Format: `## Completion Summary\n\n{llm-generated-text}` The function is called in two places: - **Line 427**: After auto-review accepts a task (tests pass) - **Line 508**: After interactive/human review accepts a task ✅ **All tests pass**: `bild --test Omni/Jr.hs` - 12/12 tests successful ✅ **Linting passes**: Both ormolu and hlint pass with no issues ✅ **Dependencies configured**: `llm` tool is included in build metadata ✅ Trigger after accepting task in review ✅ What files were modified ✅ Brief description of changes from LLM ✅ Use LLM to generate summary from diff ✅ Add as comment via TaskCore.addComment The implementation is working as specified and ready for use. Task-Id: t-193.3
2025-11-30Generate summary comment when epic children completeBen Sima
The task **t-193.2: Generate summary comment when epic children complete 1. ✅ `generateEpicSummary` function that uses LLM to generate summaries 2. ✅ Integration with `checkEpicCompletion` to trigger after epic transi 3. ✅ Prompt construction with epic info and child task details 4. ✅ Comment addition via `TaskCore.addComment` 5. ✅ Error handling for missing API keys and LLM failures 1. ✅ **`getCommitFiles` function** (lines 731-758) - Extracts and displa - ✅ All 12 tests pass - ✅ No hlint warnings - ✅ No formatting issues The feature is fully functional and ready to use. When all children of a 1. Transition the epic to Review status 2. Generate an AI summary using Claude Sonnet 4.5 3. Add that summary as a comment on the epic task 4. Include information about completed tasks, their commits, and files m Task-Id: t-193.2
2025-11-30Extract facts from completed tasks after review acceptanceBen Sima
Perfect! Let me verify the complete implementation checklist against the ✅ **1. In Jr.hs, after accepting a task in review, call fact extraction: - Line 424: `extractFacts tid commitSha` - called in `autoReview` aft - Line 504: `extractFacts tid commitSha` - called in `interactiveRevi ✅ **2. Add extractFacts function:** - Lines 585-600: Implemented with correct signature `extractFacts :: - Gets diff using `git show --stat` - Loads task context - Calls LLM CLI tool with `-s` flag - Handles success/failure cases ✅ **3. Add buildFactExtractionPrompt function:** - Lines 603-620: Implemented with correct signature - Includes task ID, title, description - Includes diff summary - Provides clear instructions for fact extraction - Includes example format ✅ **4. Add parseFacts function:** - Lines 623-627: Implemented with correct signature - Filters lines starting with "FACT: " - Calls `addFactFromLine` for each fact ✅ **5. Add addFactFromLine function:** - Lines 630-636: Implemented with correct signature - Removes "FACT: " prefix - Parses file list from brackets - Calls `Fact.createFact` with project="Omni", confidence=0.7, source - Prints confirmation message ✅ **6. Add parseFiles helper function:** - Lines 639-649: Implemented to parse `[file1, file2, ...]` format ✅ **7. Import for Omni.Fact module:** - Line 22: `import qualified Omni.Fact as Fact` already present ✅ **8. Workflow integration:** - Current: work -> review -> accept -> **fact extraction** -> done ✅ - Fact extraction happens AFTER status update to Done - Fact extraction happens BEFORE epic completion check The implementation is **complete and correct**. All functionality descri 1. ✅ Facts are extracted after task review acceptance (both auto and man 2. ✅ LLM is called with proper context (task info + diff) 3. ✅ Facts are parsed and stored with correct metadata (source_task, con 4. ✅ All tests pass (`bild --test Omni/Agent.hs`) 5. ✅ No linting errors (`lint Omni/Jr.hs`) The feature is ready for use and testing. When a task is completed and a 1. The LLM will be prompted to extract facts 2. Any facts learned will be added to the knowledge base 3. Each fact will have `source_task` set to the task ID 4. Facts can be viewed with `jr facts list` Task-Id: t-185
2025-11-30Remove amp dependency entirelyBen Sima
The build and tests pass. Let me provide a summary of the changes made: Removed the amp dependency entirely from the codebase: - Removed `runAmp` function (was running amp subprocess) - Removed `shouldUseEngine` function (env var check `JR_USE_ENGINE`) - Removed `monitorLog` and `waitForFile` helpers (for amp.log parsing) - Removed unused imports: `System.IO`, `Data.Text.IO` - Made `runWithEngine` the default/only path - Updated error messages from "amp" to "engine" - Renamed `ampOutput` parameter to `agentOutput` in `formatCommitMessage - Added `Data.IORef` import for `newIORef`, `modifyIORef'`, `readIORef` - Removed amp.log parsing code: `LogEntry`, `processLogLine`, `updateFro - Removed unused imports: `Data.Aeson`, `Data.ByteString.Lazy`, `Data.Te - Renamed `activityAmpThreadUrl` to `activityThreadUrl` - Updated field references from `activityAmpThreadUrl` to `activityThrea - Updated UI label from "Amp Thread:" to "Session:" - Updated comment from "amp completes" to "engine completes" - Updated `Amp.execute` to `Engine.runAgent` - Updated logging section to describe Engine callbacks instead of amp.lo - Updated integration test guidance to mock Engine instead of amp binary Task-Id: t-141.6
2025-11-29Store agent review notes as task commentsBen Sima
The implementation is complete. Here's a summary of what was implemented **Changes to [Omni/Jr.hs](file:///home/ben/omni/Omni/Jr.hs):** 1. **`autoReview`** - Now adds a review comment with: - Commit SHA (short) - Test target (namespace) - Result (PASSED/FAILED) - Test output (truncated to 1000 chars) when tests fail 2. **`interactiveReview`** - Now adds a human review comment with: - Commit SHA (short) - Result (ACCEPTED/REJECTED) - Rejection reason (when rejected) 3. **`handleConflict`** - Now adds a merge conflict comment with: - Commit SHA (short) - Attempt number - List of conflicting files 4. **Helper functions added:** - `buildReviewComment` - Formats auto-review results - `buildHumanReviewComment` - Formats human review results - `buildConflictComment` - Formats merge conflict info - `truncateOutput` - Truncates long test output Task-Id: t-193.4
2025-11-28Fix llm tool installation - update nixpkgs hash in Biz/Bild.nixBen Sima
The build passed. The task was to update nixpkgs hash in Biz/Bild.nix, b Task-Id: t-163
2025-11-28Implement jr facts list/show/add/delete CLI commandsBen Sima
The build and tests pass. The hlint suggestions have been fixed: 1. Changed `Text.pack <$>` to `Text.pack </` on line 528 2. Replaced the case expression with `maybe Fact.getAllFacts Fact.getFac 3. Changed `Text.pack <$>` to `Text.pack </` on line 555 Task-Id: t-158.3
2025-11-27Auto-transition epic to Review status when all children reach DoneBen Sima
The implementation is complete. Summary of changes to [Omni/Jr.hs](file: 1. Added `checkEpicCompletion` function (lines 490-508) that: - Checks if the completed task has a parent - Finds the parent task and verifies it's an Epic - Checks if all children of that epic are Done - If so, transitions the epic to Review status 2. Updated `autoReview` to call `checkEpicCompletion` after marking a ta 3. Updated `interactiveReview` to: - Accept the task as a parameter (line 414) - Call `checkEpicCompletion` after marking a task Done (line 429) 4. Updated the call site at line 361 to pass the task to `interactiveRev Task-Id: t-155.1
2025-11-27Add human notes field for intervention tasksBen Sima
All tests pass. Let me summarize the implementation: I've added a human notes field for intervention tasks with the following 1. **Omni/Task/Core.hs**: - Added `retryNotes :: Maybe Text` field to `RetryContext` data type - Added `notes` column to `retryContextColumns` for schema migration - Updated `getRetryContext` to fetch the notes field from DB - Updated `setRetryContext` to save the notes field to DB - Updated `getAllRetryContexts` to include notes - Added `updateRetryNotes :: Text -> Text -> IO ()` function to updat 2. **Omni/Jr/Web.hs**: - Added new API endpoint: `POST /tasks/:id/notes` - Added `NotesForm` type and `FromForm` instance - Added `taskNotesHandler` to save notes - Updated `renderRetryContextBanner` to accept task ID and display: - Notes textarea form when max retries exceeded (intervention tasks - Existing notes display for non-critical retry banners 3. **Omni/Agent/Worker.hs**: - Updated worker prompt to include human notes/guidance in the retry - Preserved existing notes when setting new retry context 4. **Omni/Jr.hs**: - Updated all `RetryContext` creations to preserve existing notes Task-Id: t-153.5
2025-11-27Make Omni/Jr.hs executableBen Sima
2025-11-26Jr: Gerrit-style conflict handling - kick back to coder with contextBen Sima
All tests pass and lint is clean. The implementation adds Gerrit-style c 1. **`gatherConflictContext`** - Creates rich context including: - The commit info (SHA, subject, body) - Current HEAD state (what branch moved to) - Per-file conflict details showing both your changes and recent chan 2. **`getFileConflictInfo`** - For each conflicting file, shows: - Your changes to that file (stat summary) - Recent changes by others (last 3 commits touching the file) 3. The context is stored in `retryReason` and passed to the worker via t Task-Id: t-1o2g8gudqlx
2025-11-26Jr: Sequential task IDsBen Sima
All tests pass. The implementation is complete: **Summary of changes:** 1. Removed sqids dependency from `Omni/Task/Core.hs`, `Omni/Task.hs`, an 2. Changed `generateId` in `Omni/Task/Core.hs` to produce simple sequent 3. Removed the now-unused `sqidsOptions` configuration and `Web.Sqids` i Task-Id: t-1o2g8gu9y2z
2025-11-26Port task commands to jr taskBen Sima
All tests pass. The task is complete: - ✅ `jr task list` works - ✅ `jr task create` works - ✅ `jr task show` works - ✅ All Omni/Task commands accessible via `jr task` - ✅ Reuses Omni.Task logic - ✅ Added tests for task command parsing - ✅ `bild --test Omni/Jr.hs` passes Task-Id: t-1o2egbj8o0n.2
2025-11-26Improve worker prompt and fix output interleavingBen Sima
- More explicit prompt: MUST run bild --test, fix hlint issues - Add workerQuiet flag to disable ANSI status bar in loop mode - Loop mode uses simple putText, manual jr work keeps status bar
2025-11-26Reset stuck Review tasks to Open when no commit foundBen Sima
2025-11-26Improve jr loop logging and fix review race conditionBen Sima
- Reorder loop to check pending reviews before starting new work - Loop no longer exits on missing commit (skips instead) - Add [loop], [review], [worker] prefixes to all log messages - Worker leaves task in InProgress on amp failure (avoids retry loop)
2025-11-26Remove git-tracked task references from hooks and docsBen Sima
- Remove task sync from pre-commit hook - Remove task import from post-merge and post-checkout hooks - Remove merge driver config from post-checkout - Remove merge-driver command from jr - Update Task README for SQLite storage - Delete outdated WORKER_AGENT_GUIDE.md Amp-Thread-ID: https://ampcode.com/threads/T-f2358f5a-2d4a-47e7-a895-6647474d8311 Co-authored-by: Amp <amp@ampcode.com>
2025-11-26Fix auto-review to use full namespace pathBen Sima
Task-Id: t-1o2g8gugkr1
2025-11-26Add jr loop command for autonomous work+review cycleBen Sima
- jr review [<task-id>] [--auto]: auto-accepts if tests pass - jr review (no args): picks first task in Review status - jr loop [--delay=N]: runs work->review loop continuously - Auto-review runs bild --test on task namespace Task-Id: t-1o2g8gugkr1
2025-11-26Add jr web command with Servant skeletonBen Sima
Task-Id: t-1o2g8gugkr1.1
2025-11-25jr: implement Gerrit-style conflict handlingBen Sima
- Add RetryContext to track failed attempts (merge conflicts, rejections) - jr review checks for clean cherry-pick before showing diff - If conflict detected, kicks back to coder with context - Worker prompt includes retry context (attempt count, conflict files, reason) - After 3 failed attempts, marks task for human intervention Task-Id: t-1o2g8gudqlx
2025-11-25fix(jr): review command git show argsBen Sima
Task-Id: t-1o2g8gu6p8o
2025-11-25jr: add review command, --try-opus, Task-Id trailerBen Sima
- jr review <task-id>: show diff, accept/reject/skip - Worker uses --try-opus for better code quality - Commit messages use Task-Id: trailer (Gerrit-style) Task-Id: t-1o2g8gu6p8o
2025-11-24deprecate(agent): move functionality to jrBen Sima
Moves the 'agent start' and 'agent merge-driver' commands to 'jr work' and 'jr merge-driver' respectively. Deletes Omni/Agent.hs as it is no longer the entry point. Amp-Thread-ID: https://ampcode.com/threads/T-ac41b9b6-d117-46de-9e4f-842887a22f1d Co-authored-by: Amp <amp@ampcode.com>
2025-11-24feat: implement t-1o2egbj8o0n.3Ben Sima
I have implemented the `jr work` command in `Omni/Jr.hs`. **Changes:** 1. **Modified `Omni/Jr.hs`**: * Added necessary imports (`Omni.Agent.Core`, `Omni.Agent.Worker`, `System.Directory`, `System.FilePath`, `Data.Text`). * Updated the Docopt usage to include `jr work [<task-id>]`. * Implemented the `work` command handler in the `move` function to initialize a `Worker` and call `Worker.start`, mirroring the logic in `Omni/Agent.hs`. * Added unit tests to verify parsing of the `work` command with and without a task ID. **Verification:** * Ran `bild --test Omni/Jr.hs` which passed, confirming the code compiles and tests pass. * Ran `lint Omni/Jr.hs` which passed. * Verified `_/bin/jr --help` shows the new command. I am now ready to exit.
2025-11-24Remove harvest command and documentationBen Sima
The 'harvest' functionality was tied to git-synced JSONL task files, which have been replaced by a local SQLite database. This commit removes the command from the CLI and updates documentation to reflect the new workflow. Amp-Thread-ID: https://ampcode.com/threads/T-ac41b9b6-d117-46de-9e4f-842887a22f1d Co-authored-by: Amp <amp@ampcode.com>
2025-11-24feat: implement t-1o2egbj8o0n.2Ben Sima
I have successfully integrated the existing `Omni/Task` functionality into `jr`. The `Omni/Jr.hs` file already had the logic to forward `task` commands to `Omni/Task.main`, but it was failing to compile/run because it was missing a dependency declaration for `sqlite-simple` (which `Omni/Task` relies on). I added the missing dependency to `Omni/Jr.hs`: ```haskell -- : dep sqlite-simple ``` I verified the fix by running: 1. `Omni/Ide/run.sh Omni/Jr.hs task list` - Verified it lists tasks correctly. 2. `Omni/Ide/run.sh Omni/Jr.hs task create "Test Task via Jr"` - Verified it creates tasks. 3. `Omni/Ide/run.sh Omni/Jr.hs task show <id>` - Verified it shows task details. 4. `Omni/Ide/run.sh Omni/Jr.hs task -h` - Verified it shows `task` specific help. 5. `Omni/Ide/run.sh Omni/Jr.hs task test` - Verified it runs the `Omni/Task` test suite. 6. `bild --test Omni/Jr.hs` - Verified `Omni/Jr.hs` itself builds and passes its own tests. All `jr task` commands now behave exactly like the `task` command, fulfilling the requirements. The existing `Omni/Task` logic is fully reused.
2025-11-24feat: implement t-1o2egbj8o0n.1Ben Sima
2025-11-24feat(jr): Create Omni/Jr.hs main entry pointBen Sima
Amp-Thread-ID: https://ampcode.com/threads/T-663b6704-a8b0-4983-a62f-0ef00c61410c Co-authored-by: Amp <amp@ampcode.com>