diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-24 21:43:35 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-24 21:43:35 -0500 |
| commit | 6b9b5f5129dff789753df7d0c82939d3c219b29b (patch) | |
| tree | 0e5a3015a4cb29df2adf06f18898eeda5ee2acfe /Omni | |
| parent | 32a81cad9782bb82f826307005bd187d4e6f0c93 (diff) | |
Remove harvest command and documentation
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>
Diffstat (limited to 'Omni')
| -rw-r--r-- | Omni/Agent.hs | 70 | ||||
| -rw-r--r-- | Omni/Agent/DESIGN.md | 7 | ||||
| -rw-r--r-- | Omni/Agent/WORKER_AGENT_GUIDE.md | 7 | ||||
| -rw-r--r-- | Omni/Jr.hs | 4 |
4 files changed, 4 insertions, 84 deletions
diff --git a/Omni/Agent.hs b/Omni/Agent.hs index 15ff77d..53ac5ec 100644 --- a/Omni/Agent.hs +++ b/Omni/Agent.hs @@ -10,9 +10,7 @@ module Omni.Agent where import Alpha import qualified Data.Text as Text -import qualified Data.Text.IO as TIO import qualified Omni.Agent.Core as Core -import qualified Omni.Agent.Git as Git import qualified Omni.Agent.Log as Log import qualified Omni.Agent.Worker as Worker import qualified Omni.Cli as Cli @@ -23,8 +21,6 @@ import qualified System.Directory as Directory import qualified System.Environment as Env import qualified System.Exit as Exit import System.FilePath (takeFileName) -import qualified System.IO as IO -import qualified System.IO.Temp as Temp main :: IO () main = Cli.main plan @@ -45,7 +41,6 @@ agent Usage: agent start [<task-id>] - agent harvest [--path=<path>] agent merge-driver <ours> <theirs> agent test agent --help @@ -76,7 +71,6 @@ move args let taskId = fmap Text.pack (Cli.getArg args (Cli.argument "task-id")) Worker.start worker taskId - | args `Cli.has` Cli.command "harvest" = harvest args | args `Cli.has` Cli.command "merge-driver" = mergeDriver args | otherwise = putStrLn (Cli.usage help) @@ -88,63 +82,6 @@ getArgOrExit args opt = putText <| "Error: Missing required argument " <> Text.pack (show opt) Exit.exitFailure -harvest :: Cli.Arguments -> IO () -harvest args = do - let path = Cli.getArgWithDefault args "." (Cli.longOption "path") - putText "Harvesting task updates from workers..." - - branches <- Git.listBranches path "omni-worker-*" - if null branches - then putText "No worker branches found." - else do - updated <- foldlM (processBranch path) False branches - when updated <| do - -- Consolidate - Directory.setCurrentDirectory path - -- Export to temporary file then commit? No, harvest implies we are merging back to source of truth. - -- But wait, tasks are now in SQLite. - -- If we are harvesting from branches, we are importing from JSONL in branches into our DB. - -- Then we probably want to export back to JSONL for git tracking? - -- The user said: "Remove git-tracked tasks.jsonl". - -- So harvest might need rethinking or just be disabled for now. - -- But strictly answering the compilation error: exportTasks takes an argument now. - -- Since we removed tasks.jsonl, maybe we shouldn't be exporting here at all if the goal is to just update the DB? - -- However, if harvest is about syncing multiple workers, it assumes a shared git repo. - -- If we removed git tracking of tasks, harvest via git branches makes less sense unless we still use JSONL for interchange. - -- For now, let's pass Nothing to exportTasks (stdout) which is probably not what we want, OR - -- if we want to save to DB, we don't need to call exportTasks because importTasks already updates the DB. - -- Let's remove the exportTasks call here as it seems redundant or incorrect given we removed the file. - -- But wait, if 'harvest' commits "task: harvest updates...", what is it committing? - -- The SQLite DB is likely .gitignore'd. - -- So harvest effectively does nothing useful for git if tasks are not in git. - -- I will comment out the commit and export for now to fix the build, assuming 'harvest' is legacy/deprecated with the removal of git-tracked tasks. - - -- TaskCore.exportTasks Nothing - - -- Commit if changed - -- Git.commit path "task: harvest updates from workers" - putText "Success: Task database updated." - -processBranch :: FilePath -> Bool -> Text -> IO Bool -processBranch repo updated branch = do - putText <| "Checking " <> branch <> "..." - maybeContent <- Git.showFile repo branch ".tasks/tasks.jsonl" - case maybeContent of - Nothing -> do - putText <| " Warning: Could not read .tasks/tasks.jsonl from " <> branch - pure updated - Just content -> do - -- Write to temp file - Temp.withSystemTempFile "worker-tasks.jsonl" <| \tempPath h -> do - TIO.hPutStr h content - IO.hClose h - -- Import - -- We need to ensure we are in the repo directory for TaskCore to find .tasks/tasks.jsonl - Directory.setCurrentDirectory repo - TaskCore.importTasks tempPath - putText <| " Imported tasks from " <> branch - pure True - mergeDriver :: Cli.Arguments -> IO () mergeDriver args = do ours <- getArgOrExit args (Cli.argument "ours") @@ -183,10 +120,5 @@ unitTests = Left err -> Test.assertFailure <| "Failed to parse 'start t-123': " <> show err Right args -> do args `Cli.has` Cli.command "start" Test.@?= True - Cli.getArg args (Cli.argument "task-id") Test.@?= Just "t-123", - Test.unit "can parse harvest command" <| do - let result = Docopt.parseArgs help ["harvest"] - case result of - Left err -> Test.assertFailure <| "Failed to parse 'harvest': " <> show err - Right args -> args `Cli.has` Cli.command "harvest" Test.@?= True + Cli.getArg args (Cli.argument "task-id") Test.@?= Just "t-123" ] diff --git a/Omni/Agent/DESIGN.md b/Omni/Agent/DESIGN.md index 3ff00fc..0ee1004 100644 --- a/Omni/Agent/DESIGN.md +++ b/Omni/Agent/DESIGN.md @@ -11,7 +11,6 @@ agent start <name> [--background] # Start a worker (foreground by default, back agent stop <name> # Stop a background worker agent status # List all workers and their status agent log <name> [-f] # View/tail worker logs -agent harvest # Harvest task updates from all workers agent sync # Sync local state with live (helper) ``` @@ -81,12 +80,6 @@ The Haskell implementation should replicate the logic of `start-worker.sh` but w - **Completion**: When a task finishes, print a summary line (e.g., `[✓] Task t-123 completed in 12m 30s`) and a hard line break before starting the next loop. - **History**: Previous log lines (tool outputs, thoughts) scroll up above these two status lines. -### 4.4 Harvesting -- Iterate over `.tasks/workers/` or `git worktree list`. -- For each worker, extract `.tasks/tasks.jsonl` via `git show`. -- Run `Task.import`. -- **Squashing**: If the previous commit on the target branch (live) was a harvest commit, use `git commit --amend` to consolidate updates and reduce commit noise. - ### 4.5 Git Robustness (Learnings) - **Identity**: Configure `git config user.name "Omni Worker"` and `user.email` in the worktree to clearly distinguish worker commits from human commits. - **Force Checkout**: The worker must use `git checkout -f` (or equivalent) when switching to task branches to ensure untracked files (like `.tasks/counters.jsonl`) don't block the switch. diff --git a/Omni/Agent/WORKER_AGENT_GUIDE.md b/Omni/Agent/WORKER_AGENT_GUIDE.md index e832a2a..d0bc7a7 100644 --- a/Omni/Agent/WORKER_AGENT_GUIDE.md +++ b/Omni/Agent/WORKER_AGENT_GUIDE.md @@ -90,20 +90,19 @@ task update t-123 in-progress # Sync to get latest state ./Omni/Agent/sync-tasks.sh - # Ensure the task is marked review here too (for harvest visibility) + # Ensure the task is marked review here too task update t-123 review # Commit this status change to the worker branch ./Omni/Agent/sync-tasks.sh --commit ``` - *Note: The Planner will now see 't-123' in 'Review' when it runs `harvest-tasks.sh`.* + *Note: The Planner will now see 't-123' in 'Review' when it runs `task list --status=review`.* ## 3. Planner (Reviewer) Workflow The Planner Agent (running in the main repo) will: -1. **Harvest Updates**: Run `./Omni/Agent/harvest-tasks.sh` to pull "In Progress" and "Review" statuses from workers. -2. **Find Reviews**: Run `task list --status=review`. +1. **Find Reviews**: Run `task list --status=review`. 3. **Review Code**: * Check out the feature branch: `git checkout task/t-123`. * **Rebase onto Live**: Ensure the branch is up-to-date and linear. @@ -33,14 +33,12 @@ jr Usage: jr task [<args>...] jr work [<args>...] - jr harvest [<args>...] jr test jr (-h | --help) Commands: task Manage tasks work Track work - harvest Harvest wealth Options: -h --help Show this help @@ -53,8 +51,6 @@ move args withArgs extraArgs Task.main | args `Cli.has` Cli.command "work" = do putText "Work command not implemented yet" - | args `Cli.has` Cli.command "harvest" = do - putText "Harvest command not implemented yet" | otherwise = putText (str <| Docopt.usage help) test :: Test.Tree |
