feat: Cairn Dev Loop workflow, CAIRN_PATH_GITIGNORED remediation, and test hardening - #131
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (19)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR upgrades Beads Git hooks to v1.0.5 with improved timeout handling, introduces the Cairn Dev Loop as the repository's canonical development workflow with supporting documentation and agent context profiles, and implements remediation action generation for gitignored paths. The changes span infrastructure updates, workflow documentation, and new lint remediation features. ChangesBeads Integration v1.0.5 Upgrade
Cairn Dev Loop Workflow Adoption
Gitignored Path Detection and Remediation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR introduces a documented and runnable “Cairn Dev Loop” workflow for developing Cairn using Cairn’s own queries/gates, while also improving remediation output for CAIRN_PATH_GITIGNORED and hardening related integration tests. It additionally updates Beads-related repo configuration, exported data, and git hooks.
Changes:
- Add the Cairn Dev Loop documentation + a Claude Code
/cairn-loopcommand, and record an accompanying decision. - Map
CAIRN_PATH_GITIGNOREDto a concretefix_gitignored_pathremediation action and add an integration test for it. - Harden test fixtures (git commit signing) and update Beads configuration/hooks/exports.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tests/hooks_architecture.rs |
Disables commit signing in throwaway git repos used by architecture hook tests. |
tests/gitignore_lint.rs |
Adds integration test asserting remediate --json surfaces fix_gitignored_path. |
src/query_api/handlers.rs |
Adds remediation action mapping for CAIRN_PATH_GITIGNORED. |
meta/decisions/adopt-cairn-dev-loop.md |
Records decision adopting the dev loop workflow. |
docs/agent/cairn-dev-workflow.md |
Adds canonical, detailed “Cairn Dev Loop” workflow documentation. |
CLAUDE.md |
Links to the dev loop and updates agent context guidance in the Beads block. |
AGENTS.md |
Updates agent guidance and adds Beads codex setup block. |
.gitignore |
Ignores Beads/Dolt proxied DB directory. |
.claude/settings.json |
Updates Claude Code hooks to run bd prime --hook-json at session start. |
.claude/commands/cairn-loop.md |
Adds a Claude Code command to orchestrate one dev-loop iteration. |
.beads/issues.jsonl |
Updates exported Beads issues (including adding new issues/metadata adjustments). |
.beads/interactions.jsonl |
Updates exported Beads interactions. |
.beads/hooks/prepare-commit-msg |
Updates Beads-managed hook wrapper (adds more timeout strategies). |
.beads/hooks/pre-push |
Updates Beads-managed hook wrapper (adds more timeout strategies). |
.beads/hooks/pre-commit |
Updates Beads-managed hook wrapper (adds more timeout strategies). |
.beads/hooks/post-merge |
Updates Beads-managed hook wrapper (adds more timeout strategies). |
.beads/hooks/post-checkout |
Updates Beads-managed hook wrapper (adds more timeout strategies). |
.beads/config.yaml |
Sets default Beads actor value. |
.beads/.gitignore |
Expands ignored Beads runtime/proxy/debug artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if has_gitignored_paths { | ||
| actions.push(json!({ | ||
| "priority": 2, | ||
| "action": "fix_gitignored_path", | ||
| "command": "cairn lint", |
| let output = Command::new(env!("CARGO_BIN_EXE_cairn")) | ||
| .current_dir(&root) | ||
| .args(["remediate", "--json"]) | ||
| .output()?; | ||
| let stdout = String::from_utf8(output.stdout)?; | ||
| let parsed: serde_json::Value = serde_json::from_str(&stdout)?; |
| Command::new("git") | ||
| .current_dir(root) | ||
| .args(["config", "commit.gpgsign", "false"]) | ||
| .output()?; |
| # Default actor for audit trails (overridden by BEADS_ACTOR or --actor) | ||
| # actor: "" | ||
| actor: "cairn-loop" |
| --- | ||
| id: dec.<short-name> | ||
| nodes: [<node.id>] | ||
| status: accepted | ||
| date: <YYYY-MM-DD> | ||
| --- |
Introduce a repeatable seven-phase development loop (orient, scope, propose, implement, verify, record, land) driven by cairn's own graph queries and gates. The framework verifies its own development: every iteration must leave `cairn scan` clean. - docs/agent/cairn-dev-workflow.md: canonical loop with per-phase exit criteria and the cairn commands that gate each step - .claude/commands/cairn-loop.md: /cairn-loop orchestrator command - CLAUDE.md: point to the loop from "Using cairn in this repo" - meta/decisions/adopt-cairn-dev-loop.md: decision record, the first written under the loop it describes Used the loop on its own creation: orient/scope via cairn context, neighbourhood, and rationale; verify via `cairn scan` (0 findings) and `cairn hook all` (pass). https://claude.ai/code/session_011eqwicBikHcRCCSbmu9XRM
Add test, PR, merge, and continue phases so the loop covers the whole coding path, not just authoring: write a failing-then-passing test for new behaviour, open one PR per logical unit, drive CI to green and resolve review, then select the next unit and loop. Ten phases total. - docs/agent/cairn-dev-workflow.md: phases 5 (Test), 8 (PR), 9 (Merge), 10 (Continue) with exit criteria; path-to-merge via PR-activity gating - .claude/commands/cairn-loop.md: ten-phase orchestrator, continuous - meta/decisions/adopt-cairn-dev-loop.md: record the expansion https://claude.ai/code/session_011eqwicBikHcRCCSbmu9XRM
Describe how the loop runs unattended: commit verified iterations to the working branch and substitute an internal review DAG (strict warn=fail build/clippy/scan, a subagent code-review pass, a subagent simplify pass, re-verify until clean) for the human PR review gate. The bar does not drop; it moves in-process. https://claude.ai/code/session_011eqwicBikHcRCCSbmu9XRM
A blueprint path that matches a .gitignore pattern emits a Warning and
becomes a Ghost node, but `remediate_json` dropped the code in its
`_ => {}` arm, so `cairn remediate` reported "good shape" while
`cairn lint` warned about it. Map the finding to a node-specific
`fix_gitignored_path` action (priority 2, the drift tier) so remediate
and lint agree.
Test: tests/gitignore_lint.rs drives `cairn remediate --json` on a
gitignored declared path and asserts the action names the affected node.
Fails before the fix, passes after.
https://claude.ai/code/session_011eqwicBikHcRCCSbmu9XRM
git_init() built throwaway repos that inherit ambient commit-signing config. In environments that enforce signing, the fixture's initial commit fails, leaving HEAD without cairn.blueprint; the architecture gate reads `git show HEAD:cairn.blueprint`, finds nothing to diff, and passes, so the two "gate fires" tests failed. Set commit.gpgsign=false in the fixture repo so commits always succeed. No product change. https://claude.ai/code/session_011eqwicBikHcRCCSbmu9XRM
Track this session's loop work in beads: close the two fixes landed (cairn-2r1 remediate gitignored mapping, cairn-9al architecture-gate test signing) and file three genuine findings for follow-up: - cairn-7km: handlers.rs exceeds the 500-line size gate (no directive) - cairn-v1t (epic): wire decisions into the provenance graph - (cairn-9al closed) Export the backlog to .beads/issues.jsonl so it persists across clones; ignore the local-only auto-import runtime file. https://claude.ai/code/session_011eqwicBikHcRCCSbmu9XRM
13fe8ba to
cdd6951
Compare
Summary
Cloud agent session delivering the Cairn Dev Loop: a repeatable development workflow for iterating on cairn using cairn's own graph queries and gates. Includes documentation, skill command, remediation mapping, and test fixture hardening.
Changes
docs/agent/cairn-dev-workflow.md(266 lines) defining the canonical orient/scope/propose/implement/verify/record/loop cycle.claude/commands/cairn-loop.mdcommand for Claude Code integrationmeta/decisions/adopt-cairn-dev-loop.mdrecording the architectural decisionAGENTS.mdandCLAUDE.mdwith agent context profiles and workflow referencesCAIRN_PATH_GITIGNOREDfinding to a concretefix_gitignored_pathremediation action insrc/query_api/handlers.rstest_gitignored_path_surfaces_remediation_actionintests/gitignore_lint.rstests/hooks_architecture.rsto disable commit signing in throwaway git repos (prevents failures in GPG-enforced environments)Verification
cargo test: 791 passedcargo fmt --check: cleancargo clippy --lib --tests: cleancairn lint/cairn hook all: passKnown pre-existing
src/query_api/handlers.rsexceeds the 500-line module size gate (now 783 lines). Issuecairn-7kmfiled for tracking.