Files
using.cash/AGENTS.md
rick 3a04b175a1
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
AGENTS.md: add spec sync to close-out workflow
Made-with: Cursor
2026-04-13 11:54:04 +02:00

3.4 KiB

Agent Isolation Workflow

This repository uses per-agent worktree isolation. Every agent task must run in its own branch and worktree.

Rules

  • Do not edit from the shared integration checkout.
  • Do not git checkout branches in shared checkouts while other agents may be active.
  • Use one worktree per task and one branch per worktree.
  • Keep a .agent-lock file in each active worktree.
  • Keep OpenSpec change artifacts in the main checkout under openspec/changes/, even when implementation work happens in an agent worktree.

Standard Flow

  1. Create isolated worktree and branch from integration base:
    • scripts/agent-worktree.sh create <topic> [base-branch]
  2. Work only in that worktree path:
    • .worktree/<topic>
    • Exception: create and edit OpenSpec documents in the main checkout at openspec/changes/<topic>/.
  3. Commit and push branch:
    • agent/<topic>
  4. Open PR into integration branch.
  5. After merge, remove worktree:
    • scripts/agent-worktree.sh remove <topic>

OpenSpec Artifact Persistence

Untracked files in the main checkout can vanish between agent sessions. To prevent loss of OpenSpec artifacts across phases (propose, apply, verify, archive):

  1. Commit after every phase. After creating or updating artifacts under openspec/changes/<topic>/, immediately stage and commit them in the main checkout.
  2. Before any phase, verify artifacts exist. At the start of apply, verify, or archive, confirm the change directory and its files are present. If missing, check git log --all --oneline -- openspec/changes/<topic>/ to find and restore them before proceeding.
  3. Never re-scaffold over existing artifacts. openspec new change refuses to overwrite, but if the directory was lost and you recreate it, the fresh .openspec.yaml resets artifact tracking. Restore from git history instead of re-creating.

Archive = Full Close-Out

When archiving a change, always perform the complete close-out sequence:

  1. Sync specs. Ensure OpenSpec artifacts (proposal, design, specs, tasks) reflect what was actually built — not just what was originally planned. Implementation always teaches things the spec didn't anticipate.
  2. Commit any uncommitted implementation work in the agent worktree.
  3. Merge the agent branch into the integration branch from the main checkout.
  4. Push the integration branch to origin.
  5. Archive the change artifacts (mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>).
  6. Remove the worktree and branch:
    git worktree remove .worktree/<topic> --force
    git branch -d agent/<topic>
    

"Done" means done — no orphan worktrees, no unmerged branches, no unpushed commits.

.NET SDK

The project targets .NET 8. The CI pipeline uses actions/setup-dotnet with dotnet-version: '8.0.x'.

Build Pipeline Notes

  • Force IPv4 for DNS resolution in CI: DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_DNSRESOLUTIONFAMILY: IPv4 (IPv6 can be flaky in K8s runners)
  • Use NUGET_HTTP_TIMEOUT=300 for slow cache warming on first build
  • Use --ignore-failed-sources for resilience when Nexus cache is partially available
  • Use --network-timeout 120000 for npm in CI
  • NuGet and npm cache mirrors (Nexus) are configured via repo action variables (NUGET_CACHE_URL, NPM_REGISTRY_URL)

Lock File Contract

Each active worktree contains .agent-lock with owner/task/timestamp. If lock ownership is unclear, stop and ask before making edits.