Skip to content

t1023: Reduce AGENTS.md instruction count from 67 to <50#1331

Merged
marcusquinn merged 6 commits intomainfrom
feature/t1023
Feb 13, 2026
Merged

t1023: Reduce AGENTS.md instruction count from 67 to <50#1331
marcusquinn merged 6 commits intomainfrom
feature/t1023

Conversation

@alex-solovyev
Copy link
Collaborator

@alex-solovyev alex-solovyev commented Feb 12, 2026

Summary

Reduced AGENTS.md instruction count from 67 to 49 by offloading detail to existing subagents.

Changes

  1. Task completion rulesworkflows/plans.md (consolidated 10 bullets to 3 + pointer)
  2. Task ID allocationworkflows/plans.md (consolidated 8 lines to 2 + pointer)
  3. Worktree ownershipworkflows/git-workflow.md (consolidated 5 sentences to 1 + pointer)
  4. Supervisor CLItools/ai-assistants/headless-dispatch.md (moved 20-line code block to new section)
  5. Additional consolidations in AGENTS.md:
    • Auto-dispatch paragraph shortened
    • Critical Rules bullets reduced (merged "Re-read files" into "ALWAYS Read")
    • Planning & Tasks bullets consolidated
    • Development Lifecycle sub-bullets consolidated
    • Auto-recall bullets consolidated
    • Context Compaction Commands bullets consolidated

Verification

  • Final instruction count: 49 (target: <50)
    • Directive keywords: 20
    • Top-level bullets: 22
    • Numbered items: 7
  • All pointers verified to reference correct sections in destination files
  • No new files created — pure offloading to existing subagents

Ref #1327

Summary by CodeRabbit

  • Documentation
    • Streamlined agent workflow lifecycle guidance for clearer execution
    • Added Supervisor CLI documentation for task and batch management
    • Introduced Worktree Ownership safety protocols to prevent conflicts during parallel development
    • Established Task ID Allocation framework and completion rules for task governance

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Walkthrough

These changes consolidate and restructure AI agent documentation by simplifying AGENTS.md into a concise reference, distributing detailed operational guidance across specialized workflow files (headless-dispatch.md, git-workflow.md, plans.md), and establishing explicit safety frameworks for worktree ownership and task ID allocation.

Changes

Cohort / File(s) Summary
Core Agent Documentation
.agents/AGENTS.md
Condensed lifecycle descriptions, task rules, and operational guidance; removed prescriptive details, replacing them with references to specialized workflow docs. Shifted toward concise reference over expansive step-by-step prescriptions.
Workflow & Tooling Guidance
.agents/workflows/git-workflow.md, .agents/tools/ai-assistants/headless-dispatch.md
Added "Worktree Ownership" safety section with registry-based checks and ownership-enforced cleanup rules; documented Supervisor CLI features and commands (note: duplicated Supervisor CLI blocks detected in headless-dispatch.md).
Planning & Task Management
.agents/workflows/plans.md
Introduced Task ID Allocation framework (interactive/script-based flows, distributed locking, collision prevention) and comprehensive Task Completion Rules (proof-log requirements, enforcement layers, worker restrictions).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Poem

🏗️ Docstrings condensed, wisdom spread far,
Safety rules carved on worktree and PR,
Tasks claim their IDs with distributed grace,
Order and ownership find their new place.

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ⚠️ Unable to check for merge conflicts: Failed to fetch base branch: From https://github.com/marcusquinn/aidevops
! [rejected] main -> main (non-fast-forward)
+ 85b7c2e...4398164 main -> origin/main (forced update)
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary objective: reducing AGENTS.md instruction count from 67 to under 50 through strategic consolidation and relocation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t1023
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feature/t1023
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 0 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Feb 13 00:25:06 UTC 2026: Code review monitoring started
Fri Feb 13 00:25:07 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 0

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 0
  • VULNERABILITIES: 0

Generated on: Fri Feb 13 00:25:09 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit c343c25 into main Feb 13, 2026
10 of 11 checks passed
marcusquinn added a commit that referenced this pull request Feb 13, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.agents/workflows/git-workflow.md:
- Around line 671-683: The docs show commands using worktree-helper.sh without a
path; update this block to either use the canonical script path
(~/.aidevops/agents/scripts/worktree-helper.sh) for all examples (e.g.,
~/.aidevops/agents/scripts/worktree-helper.sh registry list, ... remove, ...
clean) or add a one-line note above the commands saying "Ensure
~/.aidevops/agents/scripts is on your PATH or use the full path to
worktree-helper.sh" so that calls to worktree-helper.sh (registry list, remove,
clean) are unambiguous and not PATH-dependent.
- Around line 661-691: The "Worktree Ownership" block duplicated in
git-workflow.md (the section with the "Worktree Ownership" heading and commands
like worktree-helper.sh registry list / worktree-helper.sh remove /
worktree-helper.sh clean) must be removed from git-workflow.md and replaced with
a single cross-reference to the canonical .agents/workflows/worktree.md, or
alternatively consolidate by moving any unique content into
.agents/workflows/worktree.md and then update AGENTS.md and git-workflow.md to
point to that canonical file; ensure you keep the ownership rules and helper
command references exclusively in .agents/workflows/worktree.md and update
AGENTS.md and git-workflow.md to reference that file so guidance isn’t split
across sources.

In @.agents/workflows/plans.md:
- Around line 52-57: Update the output format line so TASK_REF is
platform-neutral instead of hardcoded to GH; replace the example
`TASK_REF=GH#NNN` with a neutral representation (e.g.,
`TASK_REF=GH#NNN|GL#NNN|NONE` or document both `GH#NNN` and `GL#NNN` and the
offline `NONE` case), and mention that TASK_OFFLINE=true/false controls when
TASK_REF may be NONE; update the description of Online (`t(N+1)`) and Offline
fallback (`t(N+100)`) examples to show both GH and GL or NONE variants so
downstream tooling won't assume only GitHub.
🧹 Nitpick comments (1)
.agents/tools/ai-assistants/headless-dispatch.md (1)

100-100: Minor: Clarify auto-detection outcome mapping.

Line 100 states: Use /save-todo after planning. Auto-detects complexity (simple → TODO.md only, complex → PLANS.md + TODO.md reference).

The phrasing "PLANS.md + TODO.md reference" could be clearer. Consider: complex → PLANS.md entry + TODO.md reference to explicitly indicate a new entry in PLANS.md is created.

Suggested clarification
-Use `/save-todo` after planning. Auto-detects complexity (simple → TODO.md only, complex → PLANS.md + TODO.md reference).
+Use `/save-todo` after planning. Auto-detects complexity (simple → TODO.md only, complex → PLANS.md entry + TODO.md reference).

Comment on lines +661 to +691
### Worktree Ownership

**CRITICAL**: NEVER remove a worktree unless you meet ALL of these conditions:

1. **You created it in this session**, OR
2. **It belongs to a task in your active batch** AND the task is deployed/complete, OR
3. **The user explicitly asks**

**Why this matters**: Worktrees may belong to parallel sessions. Removing them destroys another agent's working directory mid-work.

**Safe cleanup workflow**:

```bash
# 1. Check ownership registry
worktree-helper.sh registry list

# 2. Only remove worktrees you personally merged
# The registry tracks which PID owns each worktree

# 3. Use helper commands (they enforce ownership checks)
worktree-helper.sh remove feature/my-feature # Refuses if owned by another live process
worktree-helper.sh clean # Only removes worktrees you own
```

**What NOT to do**:

- NEVER assume unrecognized worktrees are safe to remove
- NEVER use `git worktree remove` directly (bypasses ownership checks)
- NEVER remove worktrees for tasks you didn't personally merge

**Ownership registry**: `worktree-helper.sh registry list` shows which PID owns each worktree. The `remove` and `clean` commands automatically refuse to touch worktrees owned by other live processes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for potential duplicates of Worktree Ownership guidance across .agents/
echo "=== Searching for Worktree Ownership related patterns ==="
rg -n --glob '.agents/**/*.md' "Worktree Ownership|ownership registry|worktree-helper\.sh (remove|clean|registry list)" 

echo ""
echo "=== Broader search for worktree cleanup guidance ==="
rg -n --glob '.agents/**/*.md' -i "worktree.*clean|worktree.*remov|git worktree" | head -30

Repository: marcusquinn/aidevops

Length of output: 4727


Consolidate Worktree Ownership guidance—it already exists in .agents/workflows/worktree.md.

The rg scan confirms duplication: worktree ownership, registry patterns, and safe cleanup workflows are already comprehensively documented in .agents/workflows/worktree.md (lines 387–392+). The content added to git-workflow.md:661–691 replicates this existing guidance. Per framework standards, maintain operational guidance in a single authoritative location. Either:

  1. Remove the new section from git-workflow.md and keep the reference in AGENTS.md:227 pointing to worktree.md as the primary source, or
  2. Consolidate into .agents/workflows/worktree.md if this is now the canonical reference, then update AGENTS.md and git-workflow.md to cross-reference it.

Ensure the final structure avoids split ownership guidance across files.

🤖 Prompt for AI Agents
In @.agents/workflows/git-workflow.md around lines 661 - 691, The "Worktree
Ownership" block duplicated in git-workflow.md (the section with the "Worktree
Ownership" heading and commands like worktree-helper.sh registry list /
worktree-helper.sh remove / worktree-helper.sh clean) must be removed from
git-workflow.md and replaced with a single cross-reference to the canonical
.agents/workflows/worktree.md, or alternatively consolidate by moving any unique
content into .agents/workflows/worktree.md and then update AGENTS.md and
git-workflow.md to point to that canonical file; ensure you keep the ownership
rules and helper command references exclusively in .agents/workflows/worktree.md
and update AGENTS.md and git-workflow.md to reference that file so guidance
isn’t split across sources.

Comment on lines +671 to +683
**Safe cleanup workflow**:

```bash
# 1. Check ownership registry
worktree-helper.sh registry list

# 2. Only remove worktrees you personally merged
# The registry tracks which PID owns each worktree

# 3. Use helper commands (they enforce ownership checks)
worktree-helper.sh remove feature/my-feature # Refuses if owned by another live process
worktree-helper.sh clean # Only removes worktrees you own
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clarify helper script path to avoid PATH-dependent failures.

Earlier examples use the full ~/.aidevops/agents/scripts/... path, but this block assumes worktree-helper.sh is on PATH. Please align with the canonical path or explicitly state it must be on PATH to prevent confusion in safety-critical cleanup steps.

🔧 Suggested doc tweak
-# 1. Check ownership registry
-worktree-helper.sh registry list
+# 1. Check ownership registry
+~/.aidevops/agents/scripts/worktree-helper.sh registry list
...
-worktree-helper.sh remove feature/my-feature  # Refuses if owned by another live process
-worktree-helper.sh clean                      # Only removes worktrees you own
+~/.aidevops/agents/scripts/worktree-helper.sh remove feature/my-feature  # Refuses if owned by another live process
+~/.aidevops/agents/scripts/worktree-helper.sh clean                      # Only removes worktrees you own
🤖 Prompt for AI Agents
In @.agents/workflows/git-workflow.md around lines 671 - 683, The docs show
commands using worktree-helper.sh without a path; update this block to either
use the canonical script path (~/.aidevops/agents/scripts/worktree-helper.sh)
for all examples (e.g., ~/.aidevops/agents/scripts/worktree-helper.sh registry
list, ... remove, ... clean) or add a one-line note above the commands saying
"Ensure ~/.aidevops/agents/scripts is on your PATH or use the full path to
worktree-helper.sh" so that calls to worktree-helper.sh (registry list, remove,
clean) are unambiguous and not PATH-dependent.

Comment on lines +52 to +57
**Online mode**: Creates a GitHub/GitLab issue as a distributed lock, then allocates `t(N+1)`.

**Offline fallback**: Allocates `t(N+100)` to avoid collisions (reconcile when back online).

**Output format**: `TASK_ID=tNNN TASK_REF=GH#NNN TASK_OFFLINE=false`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Make TASK_REF format platform-neutral (GitHub vs GitLab/offline).

The output format hardcodes TASK_REF=GH#NNN, but online mode can be GitHub or GitLab and offline mode may have no issue number. Consider specifying a neutral format (e.g., TASK_REF=GH#NNN|GL#NNN|NONE) or documenting the GitLab equivalent to prevent downstream tooling assumptions.

✏️ Possible wording update
-**Output format**: `TASK_ID=tNNN TASK_REF=GH#NNN TASK_OFFLINE=false`
+**Output format**: `TASK_ID=tNNN TASK_REF=GH#NNN|GL#NNN|NONE TASK_OFFLINE=false`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Online mode**: Creates a GitHub/GitLab issue as a distributed lock, then allocates `t(N+1)`.
**Offline fallback**: Allocates `t(N+100)` to avoid collisions (reconcile when back online).
**Output format**: `TASK_ID=tNNN TASK_REF=GH#NNN TASK_OFFLINE=false`
**Online mode**: Creates a GitHub/GitLab issue as a distributed lock, then allocates `t(N+1)`.
**Offline fallback**: Allocates `t(N+100)` to avoid collisions (reconcile when back online).
**Output format**: `TASK_ID=tNNN TASK_REF=GH#NNN|GL#NNN|NONE TASK_OFFLINE=false`
🤖 Prompt for AI Agents
In @.agents/workflows/plans.md around lines 52 - 57, Update the output format
line so TASK_REF is platform-neutral instead of hardcoded to GH; replace the
example `TASK_REF=GH#NNN` with a neutral representation (e.g.,
`TASK_REF=GH#NNN|GL#NNN|NONE` or document both `GH#NNN` and `GL#NNN` and the
offline `NONE` case), and mention that TASK_OFFLINE=true/false controls when
TASK_REF may be NONE; update the description of Online (`t(N+1)`) and Offline
fallback (`t(N+100)`) examples to show both GH and GL or NONE variants so
downstream tooling won't assume only GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants