Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Ralph Loop CWD Support Progress Tracker

- Owner: Jake Ruesink
- Last Updated: 2026-02-05
- Status: Active
- Task Hub: `.devagent/workspace/tasks/active/2026-02-05_ralph-loop-cwd-support/`

## Summary

Support running Ralph loops from an explicit target repository directory, even when the orchestration command is started from another directory. In parallel, preserve useful ideas from PR #100 by extracting only high-value artifacts into clean, scoped changes.

## Problem Statement

Current loop tooling assumes the process runs inside the target git repository. That assumption blocks use cases where DevAgent is invoked from one workspace while executing loops in another repository. Separately, PR #100 mixes useful material with unrelated large-scope changes, so merge is undesirable.

## Objectives

1. Add an explicit cwd/repo-root mechanism for Ralph loop execution.
2. Ensure git/beads/log path behaviors are correct in the target repository context.
3. Extract useful PR #100 artifacts without inheriting unrelated scope.

## Agent Update Instructions

- Always update "Last Updated" using ISO date.
- Progress Log: append entries; do not rewrite history.
- Implementation Checklist: mark `[x]` for complete, `[~]` for partial.
- Key Decisions: add dated decisions with rationale.

## Key Decisions

- [2026-02-05] Decision: Treat this as a new active task hub focused on loop `cwd` support plus selective PR #100 extraction (no direct merge).

## Progress Log

- [2026-02-05] Initiated: Task hub created with research + plan stubs for loop cwd support and PR #100 extraction strategy.

## Implementation Checklist

- [ ] Define API for target working directory (`--cwd`, run file field, or both).
- [ ] Update loop startup flow to resolve repo root from target cwd.
- [ ] Validate branch and Beads DB behaviors with target cwd.
- [ ] Add/adjust tests for cross-directory execution behavior.
- [ ] Extract useful PR #100 pieces in isolated commits/PR(s).

## Open Questions

- Should CLI override config (`--cwd` > run file), and what is the final precedence order?
- Should hooks receive both `repoRoot` and `processCwd` in payloads for observability?
- Which PR #100 artifacts are worth keeping versus recreating cleanly?

## References

- PR under review: `https://github.com/lambda-curry/devagent/pull/100`
- Ralph runner: `.devagent/plugins/ralph/tools/ralph.sh`
- Ralph router: `.devagent/plugins/ralph/tools/ralph.ts`
- Current e2e hook verifier: `.devagent/plugins/ralph/tools/verify-on-iteration-e2e.sh`
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Ralph Loop CWD Support

- **Status:** active
- **Owners:** Jake Ruesink
- **Summary:** Add explicit support for running Ralph loops against a target repository directory (different from the DevAgent repo cwd), and extract only the useful artifacts from PR #100 without merging the full mixed-scope PR.
- **Related missions:** Reliable autonomous loop execution, safer PR scoping
- **Latest plan:** plan/2026-02-05_ralph-loop-cwd-support-plan.md
- **Latest research:** research/2026-02-05_pr100-extraction-notes.md

## Changelog

| Date | Update | Agent/Owner |
|------|--------|-------------|
| 2026-02-05 | Created task hub | Codex |

## Open Decisions

- Should run config use `run.execution.cwd`, a CLI flag `--cwd`, or both?
- Should branch and Beads validations always run in the target cwd when provided?
- Should relative paths in run/config files resolve from the target cwd or the current process cwd?

## Research Artifacts

- Store discovery packets in `research/` using ISO date prefixes and concise suffixes.

## Plan Artifacts

- Publish implementation plans in `plan/` with matching ISO date prefixes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Ralph Loop CWD Support - Implementation Plan

- Owner: Jake Ruesink
- Last Updated: 2026-02-05
- Status: Draft
- Related Task Hub: `.devagent/workspace/tasks/active/2026-02-05_ralph-loop-cwd-support/`

## Summary

Add first-class support for running Ralph loops against a target repository directory while invoking the tool from a different cwd. Then extract only useful PR #100 artifacts into clean, reviewable commits.

## Objectives

1. Support explicit target cwd/repo-root for loop execution.
2. Preserve existing behavior when cwd is not provided.
3. Keep extraction from PR #100 selective and scope-safe.

## Implementation Tasks

### Task 1: Design cwd control contract

- Decide and document config/CLI contract:
- Option A: `--cwd <path>`
- Option B: run-file field (e.g. `run.execution.cwd`)
- Option C: both with clear precedence
- Acceptance criteria:
- Contract documented in this plan + tracker.
- Backwards compatibility defined.

### Task 2: Implement target-cwd execution path

- Update loop startup in `.devagent/plugins/ralph/tools/ralph.sh` (and router integration as needed) so git/beads/log resolution uses target cwd when configured.
- Acceptance criteria:
- `git rev-parse`, branch checks, and repo-root dependent paths work in target cwd.
- Existing invocation without cwd behaves unchanged.

### Task 3: Validate and test

- Add or update tests/scripts for cross-directory behavior.
- Include one practical verification command showing loop execution from non-target cwd.
- Acceptance criteria:
- Verification command is reproducible.
- Failure mode is clear when cwd is invalid/non-git.

### Task 4: Extract useful PR #100 bits

- Apply selective extraction strategy from research doc.
- Fix known script fragility during extraction (repo-root resolution assumptions).
- Acceptance criteria:
- Extracted changes are narrow and independently reviewable.
- No unrelated bulk docs/task artifacts included.

## Risks

- Path resolution regressions for existing single-repo flows.
- Hidden assumptions in helper scripts that still rely on current process cwd.
- Accidental scope creep while extracting from mixed PR.

## Validation Checklist

- [ ] Run targeted loop command with explicit cwd.
- [ ] Confirm branch and epic checks execute in target repository.
- [ ] Confirm logs and artifact paths are deterministic.
- [ ] Confirm extraction PR diff matches title/scope.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# PR #100 Extraction Notes (Selective, No Merge)

## Context

PR #100 (`Setup wake hook E2E test loop`) is open, conflicting, and oversized for its title/scope. Goal is to extract helpful bits only.

## High-Value Candidates to Keep

1. **Loop hook verification patterns**
- Script pattern for validating hook payload keys end-to-end.
- Candidate source: `.devagent/plugins/ralph/tools/verify-on-iteration-e2e.sh` (requires path fix before reuse).

2. **Minimal wake-hook test fixture pattern**
- Marker file + verify script pattern for low-cost smoke validation.
- Candidate sources:
- `.devagent/workspace/tests/wake-hook-test/marker.txt`
- `.devagent/workspace/tests/wake-hook-test/verify.sh`

3. **Process learnings in revise report**
- Keep actionable learnings, especially around repeatable verification and avoiding mutation of shared files in tests.
- Candidate source: `.devagent/workspace/reviews/2026-02-03_devagent-wake-hook-test-improvements.md`

## Items to Avoid Carrying Over

- Massive cross-epic documentation payload not related to wake-hook/cwd objective.
- Local branch-specific config toggles in shared config files.
- Any change that broadens PR scope beyond loop-cwd and extraction objective.

## Extraction Strategy

1. Do **not** merge PR #100.
2. Create clean commits on a fresh branch for each retained idea.
3. Recreate or cherry-pick only the needed files; avoid mixed commits.
4. For each extracted item, add a short rationale in commit message/body.

## Initial Acceptance Criteria

- Extracted artifacts are self-contained and pass local verification.
- No unrelated task-hub/doc sweep included.
- Resulting PR title and changed files match actual scope.