# Ticket: Repo and agent workspace isolation

## Metadata
- Type: Ticket
- Status: Done
- Project: Nimrod / Homelab Operations
- Created: 2026-06-06
- Updated: 2026-06-06
- Priority: High

## Goal

Design a safer workspace/repository model so multiple agents can work without leaving unrelated dirty files in the same git repository or blocking each other with partial work.

## Why

Multiple agents are currently operating in the same Nimrod repository. One agent terminated part way through Vaultwarden setup, leaving dirty files. Shared dirty work makes review, rollback, commit hygiene, and agent handoff difficult.

## Scope

Included:
- Define when work should stay in the Nimrod coordination repo versus move to a project-specific repo
- Define per-agent workspace rules
- Define branch/worktree conventions for concurrent work
- Define cleanup/handoff expectations when an agent stops mid-task
- Define how infra/service repos should relate to tickets/specs in Nimrod

Not included:
- Migrating all existing files immediately
- Deploying a Git hosting service; tracked separately

## Acceptance Criteria

This ticket is done when:
- [x] A repo/workspace isolation policy is documented — `docs/repo-and-agent-workspace-isolation.md`
- [x] A convention exists for agent-owned branches or git worktrees — documented in the policy
- [x] A convention exists for service-specific repos — documented in the policy
- [x] A terminated-agent recovery checklist exists — `docs/templates/terminated-agent-recovery-template.md`; policy references it
- [x] Current dirty files are triaged into keep/revert/move/commit decisions — working tree is clean; historical dirty work was covered by prior commits and investigations

## Questions

- Should Nimrod remain the coordination repo only, with service code/config moved elsewhere?
- Should each agent get a dedicated clone/worktree?
- Should infrastructure-as-code live in one homelab repo or per-service repos?
- What local path convention should be used for future repos?

## Progress

2026-06-07:
- Drafted `docs/repo-and-agent-workspace-isolation.md` covering: when work stays in Nimrod repo vs service-specific repos, branch/worktree conventions, service repo naming/referencing, terminated-agent recovery cross-reference, and enforcement.
- Updated `AGENTS.md` to link the new policy in both the Multi-Agent section and the Key Retrieval Map.
- Policy references the existing terminated-agent recovery template and context-hygiene doc rather than duplicating them.
- Current working tree is clean; the dirty-work triage covered in the investigation artifact was resolved by prior commits.

All ACs satisfied. The policy doc, branch/worktree convention, service-repo convention, recovery checklist reference, and dirty-work resolution are all covered.

## Notes

- This ticket was created after the user identified dirty files from multiple agents as an operational issue.
- Dirty work investigation: `tickets/artifacts/2026-06-06-repo-and-agent-workspace-isolation/dirty-work-investigation-2026-06-06.md`.
- Policy refinement added: if unrelated dirty files exist, agents should stop/triage or isolate work in a branch/worktree rather than adding new implementation work to the same tree by default.
