diff options
| -rw-r--r-- | Omni/Agent/WORKER_AGENT_GUIDE.md | 124 | ||||
| -rwxr-xr-x | Omni/Ide/hooks/post-checkout | 9 | ||||
| -rwxr-xr-x | Omni/Ide/hooks/post-merge | 5 | ||||
| -rwxr-xr-x | Omni/Ide/hooks/pre-commit | 6 | ||||
| -rw-r--r-- | Omni/Jr.hs | 32 | ||||
| -rw-r--r-- | Omni/Task/README.md | 61 |
6 files changed, 11 insertions, 226 deletions
diff --git a/Omni/Agent/WORKER_AGENT_GUIDE.md b/Omni/Agent/WORKER_AGENT_GUIDE.md deleted file mode 100644 index d0bc7a7..0000000 --- a/Omni/Agent/WORKER_AGENT_GUIDE.md +++ /dev/null @@ -1,124 +0,0 @@ -# Worker Agent Guide - -This guide describes how to run a headless Worker Agent using the Multi-Agent Workflow. - -## 1. Setup - -First, create a dedicated worktree for the worker: - -```bash -./Omni/Agent/setup-worker.sh omni-worker-1 -``` - -This creates `../omni-worker-1` sharing the same git history but with its own workspace and branch (`omni-worker-1`). - -## 2. Worker Loop - -The Worker Agent should run the following loop continuously: - -### Step 1: Sync and Find Work - -```bash -# Go to worker directory -cd ../omni-worker-1 - -# Update base branch with latest live code -# We use rebase to keep history linear (patch-based workflow) -# The custom merge driver handles tasks.jsonl conflicts during rebase -git fetch origin live -git rebase origin/live - -# Sync tasks from the live branch -./Omni/Agent/sync-tasks.sh - -# Check for ready tasks -task ready --json -``` - -### Step 2: Claim Task - -If a task is found (e.g., `t-123`): - -```bash -# Mark in progress -task update t-123 in-progress - -# Commit the claim locally -./Omni/Agent/sync-tasks.sh --commit -``` - -### Step 3: Create Workspace - -**CRITICAL: Determine the correct base branch.** - -1. **Check Dependencies**: Run `task deps t-123 --json`. -2. **Check for Unmerged Work**: Look for dependencies that have existing branches (e.g., `task/t-parent-id`) which are NOT yet merged into `live`. -3. **Select Base**: - * If you find an unmerged dependency branch, check it out: `git checkout task/t-parent-id`. - * Otherwise, start from fresh live code: `git checkout -b task/t-123 live`. - -4. **Implement**: - (Proceed to implementation) - -### Step 4: Implement - -1. Read task details: `task show t-123` -2. Implement changes. -3. **Run Tests**: `bild --test Omni/YourNamespace.hs` - -### Step 5: Submit for Review - - 1. **Update Status and Commit**: - Bundle the task status update with your implementation to keep history clean. - - ```bash - # 1. Mark task for review (updates .tasks/tasks.jsonl) - task update t-123 review - - # 2. Commit changes + task update - git add . - git commit -m "feat: implement t-123" - ``` - - 2. **Signal Review Readiness**: - Update the worker branch to signal the planner. - - ```bash - # Switch to base branch - git checkout omni-worker-1 - - # Sync to get latest state - ./Omni/Agent/sync-tasks.sh - - # 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 `task list --status=review`.* - -## 3. Planner (Reviewer) Workflow - -The Planner Agent (running in the main repo) will: -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. - ```bash - git rebase live - ``` - * Run tests and review code. -4. **Merge**: - * `git checkout live` - * `git merge task/t-123` (This will now be a fast-forward or clean merge) -5. **Complete**: - * `task update t-123 done` - * `git commit -am "task: t-123 done"` - -## Troubleshooting - -If `sync-tasks.sh` reports a conflict: -1. Manually run `task import -i .tasks/live-tasks.jsonl` -2. If git merge conflicts occur in `tasks.jsonl`, the custom merge driver should handle them. If not, resolve by keeping the union of tasks (or letting `task import` decide). diff --git a/Omni/Ide/hooks/post-checkout b/Omni/Ide/hooks/post-checkout index 7c8bcb9..a360517 100755 --- a/Omni/Ide/hooks/post-checkout +++ b/Omni/Ide/hooks/post-checkout @@ -15,15 +15,6 @@ then MakeTags "${changed[@]}" fi -# Configure git merge driver for tasks -git config merge.agent.name "Agent Merge Driver" || true -git config merge.agent.driver "agent merge-driver %A %B" || true - -# Task manager: Import tasks after branch switch -if [ -f .tasks/tasks.jsonl ]; then - task import -i .tasks/tasks.jsonl 2>/dev/null || true -fi - ## START BRANCHLESS CONFIG git branchless hook post-checkout "$@" diff --git a/Omni/Ide/hooks/post-merge b/Omni/Ide/hooks/post-merge index 3e0495b..bf0e996 100755 --- a/Omni/Ide/hooks/post-merge +++ b/Omni/Ide/hooks/post-merge @@ -1,11 +1,6 @@ #!/usr/bin/env bash "${CODEROOT:?}"/Omni/Ide/hooks/post-checkout 'HEAD@{1}' HEAD -# Task manager: Import tasks after git pull/merge -if [ -f .tasks/tasks.jsonl ]; then - task import -i .tasks/tasks.jsonl 2>/dev/null || true -fi - ## START BRANCHLESS CONFIG git branchless hook post-merge "$@" diff --git a/Omni/Ide/hooks/pre-commit b/Omni/Ide/hooks/pre-commit index d096f5b..06f1716 100755 --- a/Omni/Ide/hooks/pre-commit +++ b/Omni/Ide/hooks/pre-commit @@ -18,10 +18,4 @@ fi done lint "${changed[@]}" - - # Task manager: Export tasks before commit - if [ -d .tasks ]; then - task export --flush 2>/dev/null || true - git add .tasks/tasks.jsonl 2>/dev/null || true - fi ## @@ -24,7 +24,6 @@ import qualified Omni.Test as Test import qualified System.Console.Docopt as Docopt import qualified System.Directory as Directory import System.Environment (withArgs) -import qualified System.Environment as Env import qualified System.Exit as Exit import System.FilePath (takeFileName) import qualified System.IO as IO @@ -53,7 +52,6 @@ Usage: jr web [--port=PORT] jr review [<task-id>] [--auto] jr loop [--delay=SECONDS] - jr merge-driver <ours> <theirs> jr test jr (-h | --help) @@ -63,7 +61,6 @@ Commands: web Start the web UI server review Review a completed task (show diff, accept/reject) loop Run autonomous work+review loop - merge-driver Internal git merge driver Options: -h --help Show this help @@ -117,37 +114,8 @@ move args Just d -> fromMaybe 5 (readMaybe d) Nothing -> 5 runLoop delay - | args `Cli.has` Cli.command "merge-driver" = mergeDriver args | otherwise = putText (str <| Docopt.usage help) -mergeDriver :: Cli.Arguments -> IO () -mergeDriver args = do - ours <- getArgOrExit args (Cli.argument "ours") - theirs <- getArgOrExit args (Cli.argument "theirs") - - -- Set TASK_DB_PATH to ours (the file git provided as the current version) - -- Since we are no longer using git-tracked tasks.jsonl, this merge driver logic needs rethinking. - -- If the merge driver is called, it means git found a conflict in .tasks/tasks.jsonl, but we deleted it. - -- So this code might be dead, or we might be dealing with legacy files during a rebase. - -- For now, we'll keep the logic but be aware it's likely unused. - Env.setEnv "TASK_DB_PATH" ours - -- TaskCore.importTasks theirs - -- Task.importTasks theirs - - -- We need to call task import via CLI or library. - -- Omni.Task.importTasks IS NOT EXPOSED. - -- But we can call Task.main - withArgs ["import", "-i", theirs] Task.main - Exit.exitSuccess - -getArgOrExit :: Cli.Arguments -> Docopt.Option -> IO String -getArgOrExit args opt = - case Cli.getArg args opt of - Just val -> pure val - Nothing -> do - putText <| "Error: Missing required argument " <> Text.pack (show opt) - Exit.exitFailure - -- | Run the autonomous loop: work -> review -> repeat runLoop :: Int -> IO () runLoop delaySec = do diff --git a/Omni/Task/README.md b/Omni/Task/README.md index 21cf889..5113002 100644 --- a/Omni/Task/README.md +++ b/Omni/Task/README.md @@ -1,8 +1,7 @@ # Task Manager for AI Agents The task manager is a dependency-aware issue tracker inspired by beads. It uses: -- **Storage**: Local JSONL file (`.tasks/tasks.jsonl`) -- **Sync**: Git-tracked (automatically synced across machines) +- **Storage**: SQLite database (`~/.cache/omni/tasks/tasks.db`) - **Dependencies**: Tasks can block other tasks - **Ready work detection**: Automatically finds unblocked tasks @@ -96,7 +95,7 @@ task update t-20241108120000 in-progress task update t-20241108120000 done ``` -**Note**: Task updates modify `.tasks/tasks.jsonl` but don't auto-commit. The pre-commit hook will automatically export and stage task changes on your next `git commit`. +**Note**: Task updates are immediately saved to the SQLite database. ## View Dependencies ```bash @@ -123,10 +122,10 @@ task tree t-abc123 # Show specific epic/task with its children ## Export Tasks ```bash -task export [--flush] +task export [-o <file>] ``` -Consolidates and exports tasks to `.tasks/tasks.jsonl`, removing duplicates. The `--flush` flag forces immediate export (used by git hooks). +Exports tasks to JSONL format (stdout by default, or to a file with `-o`). ## Import Tasks ```bash @@ -137,20 +136,15 @@ Imports tasks from a JSONL file, merging with existing tasks. Newer tasks (based Examples: ```bash -task import -i .tasks/tasks.jsonl task import -i /path/to/backup.jsonl ``` ## Initialize (First Time) ```bash -task init --quiet # Non-interactive (recommended for agents) -# OR -task init # Interactive (for humans) +task init ``` -Creates `.tasks/` directory and `tasks.jsonl` file. - -**Agents MUST use `--quiet` flag** to avoid interactive prompts. +Creates the SQLite database at `~/.cache/omni/tasks/tasks.db`. ## Common Workflows @@ -325,32 +319,21 @@ AI assistants often create planning and design documents during development: - A task is **ready** if all its dependencies are `done` (or it has no dependencies) - `task ready` only shows tasks with status `open` or `in-progress` that are not blocked -## File Structure - -``` -.tasks/ -├── tasks.jsonl # Git-tracked, production database -├── tasks-test.jsonl # Test database (not tracked, auto-created) - -Omni/Ide/hooks/ -├── pre-commit # Exports tasks before commit (auto-stages tasks.jsonl) -├── post-checkout # Imports tasks after branch switch -└── ... # Other git hooks -``` +## Storage -Each line in `tasks.jsonl` is a JSON object representing a task. +Tasks are stored in a SQLite database at `~/.cache/omni/tasks/tasks.db`. This is a local database, not git-tracked. -**Git Hooks**: This repository uses hooks from `Omni/Ide/hooks/` (configured via `core.hooksPath`). Do NOT add hooks to `.git/hooks/` - they won't be version controlled and may cause confusion. +To back up or transfer tasks, use `task export` and `task import`. ## Testing and Development -**CRITICAL**: When manually testing task functionality (like tree visualization, flag ordering, etc.), you MUST use the test database: +**CRITICAL**: When manually testing task functionality, use the test database: ```bash # Set test mode to protect production database export TASK_TEST_MODE=1 -# Now all task operations use .tasks/tasks-test.jsonl +# Now all task operations use .tasks/tasks-test.db task create "Test task" --type=task task list task tree @@ -361,28 +344,6 @@ unset TASK_TEST_MODE **The test suite automatically uses test mode** - you don't need to set it manually when running `task test` or `bild --test Omni/Task.hs`. -**NEVER run manual tests against the production database** (`.tasks/tasks.jsonl`). This pollutes it with test data that must be manually cleaned up. Always use `TASK_TEST_MODE=1` for experimentation. - -## Integration with Git - -The `.tasks/tasks.jsonl` file is git-tracked. When you: -- Create/update tasks locally -- Commit and push -- Other machines/agents get the updates on `git pull` - -**Important**: Add to `.gitignore`: -``` -.tasks/*.db -.tasks/*.db-journal -.tasks/*.sock -``` - -But **do** track: -``` -!.tasks/ -!.tasks/tasks.jsonl -``` - ## Troubleshooting ### "Task not found" |
