Skip to content

t2849: Add repo routing guidance to self-improvement section#2850

Merged
alex-solovyev merged 4 commits intomainfrom
bugfix/repo-routing-self-improvement
Mar 5, 2026
Merged

t2849: Add repo routing guidance to self-improvement section#2850
alex-solovyev merged 4 commits intomainfrom
bugfix/repo-routing-self-improvement

Conversation

@alex-solovyev
Copy link
Collaborator

@alex-solovyev alex-solovyev commented Mar 4, 2026

Summary

  • Adds a repo routing heuristic to the AGENTS.md Self-Improvement section so agents distinguish framework-level issues from project-specific ones before creating tasks
  • Adds a corresponding self-improvement repo routing paragraph to prompts/build.txt in the Cross-repo task creation section, reinforcing the same heuristic where cross-repo mechanics are documented
  • Framework-level indicators: files under ~/.aidevops/, framework scripts (ai-actions.sh, ai-lifecycle.sh, supervisor/, dispatch.sh, etc.), agent prompt behaviour, supervisor/pulse logic
  • Project-specific indicators: CI, code patterns, dependencies, domain logic

Problem

Supervisors running /pulse against non-aidevops repos were creating self-improvement tasks (TODO entries + GitHub issues) in the current project repo even when the improvement targeted aidevops framework internals. This caused:

  1. Framework tasks invisible to framework maintainers
  2. Task ID namespace pollution (aidevops IDs in project TODO.md)
  3. PRs merged in wrong repos with fixes that get overwritten on next aidevops update

Evidence: t3644, t4107, t9411 all filed in qs-agency but targeting ai-actions.sh, supervisor evaluate/dispatch, and ai-lifecycle.sh.

Changes

File Change
.agents/AGENTS.md New "Route to the correct repo" paragraph in Self-Improvement section with framework vs project heuristic
.agents/prompts/build.txt New "Self-improvement repo routing" paragraph in Cross-repo task creation section

Closes #2849

Summary by CodeRabbit

  • Documentation
    • Clarified routing to distinguish framework-level vs project-specific improvements and avoid misrouting.
    • Added guidance and decision prompts for uncertain cases to determine correct destination.
    • Made issue creation conditional—create issues only when no existing ID is detected to prevent duplicates.
    • Reordered and reworded self-improvement and workflow steps to emphasize correct routing before task creation.

Self-improvement tasks created by supervisors running in project repos were
being filed in the current project instead of the aidevops repo when they
targeted framework components. Add a routing heuristic to both AGENTS.md
(Self-Improvement section) and build.txt (Cross-repo task creation) so agents
distinguish framework-level issues from project-specific ones and route to
the correct repo using claim-task-id.sh and gh issue create --repo.

Closes #2849
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue where self-improvement tasks generated by supervisors were being incorrectly filed in project-specific repositories instead of the core aidevops framework repository. This misrouting led to framework-level tasks becoming invisible to maintainers, polluting project task namespaces, and causing fixes to be overwritten. The changes introduce clear guidance and heuristics to ensure that agents correctly route self-improvement tasks to either the framework or the current project based on the nature of the problem, thereby improving task visibility, maintainability, and preventing future task management issues.

Highlights

  • Repo Routing Guidance: Introduced a heuristic in AGENTS.md to help agents distinguish between framework-level and project-specific issues for self-improvement tasks, ensuring they are filed in the correct repository.
  • Prompt Reinforcement: Added corresponding self-improvement repo routing instructions to prompts/build.txt to reinforce the heuristic for cross-repo task creation, guiding agents on where to create issues.
Changelog
  • .agents/AGENTS.md
    • Added a new section "Route to the correct repo" under Self-Improvement, detailing indicators for framework-level vs. project-specific issues and providing instructions on how to route them.
  • .agents/prompts/build.txt
    • Inserted a "Self-improvement repo routing" paragraph within the Cross-repo task creation section, providing a heuristic for agents to route tasks to the aidevops repo for framework-level issues.
Activity
  • No activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce45a4dc-2576-4a76-963a-43dbc1e3ee0c

📥 Commits

Reviewing files that changed from the base of the PR and between 27f65cf and 35316e8.

📒 Files selected for processing (2)
  • .agents/AGENTS.md
  • .agents/prompts/build.txt

Walkthrough

Adds routing rules and conditional issue-creation for agent self‑improvement: detect whether observations target aidevops framework or the current project, allocate task IDs with claim-task-id.sh for the appropriate repo, and create GitHub issues only when no existing ref:GH# / --no-issue indicator is present.

Changes

Cohort / File(s) Summary
Agent Self-Improvement Routing
.agents/AGENTS.md
Adds routing heuristics to distinguish framework-level vs project-level self‑improvement, instructs using claim-task-id.sh --repo-path and gh issue create --repo for aidevops-targeted tasks, and clarifies when not to create issues.
Build Prompt Rules
.agents/prompts/build.txt
Makes issue creation conditional by detecting existing ref:GH#/ref:GL# tokens or --no-issue, expands cross-repo routing guidance to send framework tasks to aidevops and keep project tasks local, and integrates this into pre-edit/git-traceability rules.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Agent as Agent
  participant Claim as claim-task-id.sh
  participant GH as GitHub API
  participant Repo as Destination Repo
  Agent->>Agent: Analyze observation (files, scripts, paths)
  alt framework-related detected (e.g., ~/.aidevops/, ai-actions.sh)
    Agent->>Claim: request task ID (--repo-path aidevops)
    Claim-->>Agent: returns token (ref:GH# / ref:GL# / local token)
    alt no existing ref / need issue
      Agent->>GH: gh issue create --repo aidevops
      GH-->>Agent: issue number / URL
      Agent->>Repo: write TODO / reference ref:GH#NNN
    end
  else project-related
    Agent->>Claim: request task ID (current repo)
    Claim-->>Agent: returns token (ref:GH# / ref:GL# / local token)
    alt no existing ref / need issue
      Agent->>GH: gh issue create --repo current
      GH-->>Agent: issue number / URL
      Agent->>Repo: write TODO / reference ref:GH#NNN
    end
  end
  Agent->>Agent: proceed with worktree + PR flow if code edits required
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🧭 When agents find a framework fray,
They claim the right ID and send it away.
Skip the duplicate shout, route with care,
Issues land where they belong — fair and square. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding repo routing guidance to the self-improvement section to address the linked issue #2849.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #2849: adds routing heuristics to distinguish framework-level from project-specific improvements, documents indicators for both categories, and implements conditional issue creation to prevent duplicates.
Out of Scope Changes check ✅ Passed All changes are tightly scoped to issue #2849: two documentation files updated with repo routing guidance and conditional issue creation logic, with no unrelated modifications introduced.
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 bugfix/repo-routing-self-improvement

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

github-actions bot commented Mar 4, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Mar 4 22:32:19 UTC 2026: Code review monitoring started
Wed Mar 4 22:32:20 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 107

📈 Current Quality Metrics

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

Generated on: Wed Mar 4 22:32:23 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds important guidance to both the agent documentation (AGENTS.md) and the agent prompts (build.txt) on how to correctly route self-improvement tasks to either the project-specific repository or the central aidevops framework repository. The changes are clear, well-motivated, and directly address the problem of framework-related tasks being incorrectly filed in project repositories. I have one minor suggestion to improve consistency between the two updated files.

Note: Security Review has been skipped due to the limited scope of the PR.

3. Create a GitHub issue: `gh issue create --repo <slug> --title "tNNN: description"`. Record `ref:GH#NNN` in TODO.md. (If `claim-task-id.sh` already created the issue, this step is done.)
4. Code changes in the current repo still require a worktree + PR as normal.

**Self-improvement repo routing:** When creating self-improvement tasks (see AGENTS.md "Self-Improvement"), route to the correct repo — not the repo you happen to be running in. Heuristic: if the observation references files under `~/.aidevops/`, framework scripts (`ai-actions.sh`, `ai-lifecycle.sh`, `supervisor/`, `dispatch.sh`, `pre-edit-check.sh`, helper scripts), agent prompt behaviour, or supervisor/pulse/orchestration logic, the task belongs in the aidevops repo. Use `claim-task-id.sh --repo-path <aidevops-path>` and `gh issue create --repo <aidevops-slug>`. Project-specific problems (CI, code, dependencies, domain logic) stay in the current repo. Framework tasks filed in project repos are invisible to framework maintainers and pollute the project's ID namespace.

Choose a reason for hiding this comment

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

medium

For consistency with the guidance in AGENTS.md and to improve clarity for the agent, it's better to use the more descriptive placeholder <aidevops-repo-path> instead of <aidevops-path>. This makes it clearer that a path to a repository is expected.

**Self-improvement repo routing:** When creating self-improvement tasks (see AGENTS.md "Self-Improvement"), route to the correct repo — not the repo you happen to be running in. Heuristic: if the observation references files under `~/.aidevops/`, framework scripts (`ai-actions.sh`, `ai-lifecycle.sh`, `supervisor/`, `dispatch.sh`, `pre-edit-check.sh`, helper scripts), agent prompt behaviour, or supervisor/pulse/orchestration logic, the task belongs in the aidevops repo. Use `claim-task-id.sh --repo-path <aidevops-repo-path>` and `gh issue create --repo <aidevops-slug>`. Project-specific problems (CI, code, dependencies, domain logic) stay in the current repo. Framework tasks filed in project repos are invisible to framework maintainers and pollute the project's ID namespace.

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/AGENTS.md:
- Around line 58-59: Update the guidance in AGENTS.md to clarify that gh issue
create should only be run when an issue hasn’t already been created by
claim-task-id.sh; change the wording around the two commands (claim-task-id.sh
and gh issue create) to make the second conditional (e.g., run gh issue create
only if claim-task-id.sh was invoked with --no-issue or if no ref:GH# token was
produced), and mention the check (presence of ref:GH# or the --no-issue flag) to
avoid duplicate issues.

In @.agents/prompts/build.txt:
- Around line 203-204: The guidance for routing self-improvement tasks may cause
duplicate issues because it always instructs running gh issue create --repo
after claim-task-id.sh; update the wording to mirror the conditional workflow
used in AGENTS.md (lines ~197-201) so that gh issue create --repo is only
invoked when claim-task-id.sh did not already create or reserve the issue ID;
specifically mention the heuristic for aidevops paths and update the
instructions around claim-task-id.sh and gh issue create --repo to be
conditional (i.e., run claim-task-id.sh --repo-path <aidevops-path> first, and
only call gh issue create --repo <aidevops-slug> when claim-task-id.sh did not
create the GitHub issue).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8cb2c20f-aecd-48c5-9cb6-6c4725a7d6c5

📥 Commits

Reviewing files that changed from the base of the PR and between efd4d46 and 89fb154.

📒 Files selected for processing (2)
  • .agents/AGENTS.md
  • .agents/prompts/build.txt

@alex-solovyev
Copy link
Collaborator Author

Fixed CodeRabbit CHANGES_REQUESTED findings in commit 27f65cf:

gh issue create is now conditional on claim-task-id.sh not having already created the issue. The check is: presence of a ref:GH# token in claim-task-id.sh output, or use of the --no-issue flag. Only when neither condition is met should gh issue create be run — otherwise it would produce a duplicate.

Applied consistently across all 3 locations:

  1. .agents/AGENTS.md line 58 — Self-Improvement "Route to the correct repo" (Framework-level bullet)
  2. .agents/AGENTS.md line 161 — Cross-repo task creation step 3
  3. .agents/prompts/build.txt lines 200 and 203 — Cross-repo task creation step 3 + Self-improvement repo routing

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Mar 4 23:07:52 UTC 2026: Code review monitoring started
Wed Mar 4 23:07:53 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 107

📈 Current Quality Metrics

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

Generated on: Wed Mar 4 23:07:56 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@alex-solovyev
Copy link
Collaborator Author

Dispatching worker to address CodeRabbit review feedback:

  1. Make gh issue create conditional in .agents/AGENTS.md (~line 58-59) — only run when claim-task-id.sh did not already create the issue
  2. Same fix in .agents/prompts/build.txt (~line 203-204) — mirror the conditional workflow from AGENTS.md

Worker dispatched to branch bugfix/repo-routing-self-improvement.

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/AGENTS.md:
- Line 58: The duplicate-issue guard is checking for the wrong token format
(`ref:GH#`) while claim-task-id.sh emits `ref=GH#NNN` or `ref=GL#NNN`; update
the conditional logic or documentation text that references `ref:GH#` to expect
`ref=GH#`/`ref=GL#` (i.e. `=` not `:`) wherever the check occurs (references:
claim-task-id.sh output token, the guard that decides whether to run `gh issue
create`, and the textual references in AGENTS.md) so the guard correctly detects
existing issues and prevents duplicate `gh issue create` calls.

In @.agents/prompts/build.txt:
- Line 200: The guard that detects whether an issue was already created must
match the exact token format emitted by claim-task-id.sh; update the checks that
currently look for "ref:GH#" to instead look for "ref=GH#" and also accept
"ref=GL#" (or a regex covering ref=G[HL]#) so existing GitHub/GitLab refs are
recognized and you don't create duplicate issues; update the mention in the
steps (and any conditional logic that inspects claim-task-id.sh output) to use
the corrected token format and include both ref=GH# and ref=GL# variants.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71a04bc4-79cd-4945-8c14-1551afd2ed56

📥 Commits

Reviewing files that changed from the base of the PR and between 89fb154 and 27f65cf.

📒 Files selected for processing (2)
  • .agents/AGENTS.md
  • .agents/prompts/build.txt

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Mar 4 23:11:37 UTC 2026: Code review monitoring started
Wed Mar 4 23:11:37 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 107

📈 Current Quality Metrics

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

Generated on: Wed Mar 4 23:11:40 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@alex-solovyev
Copy link
Collaborator Author

Fixed all CodeRabbit CHANGES_REQUESTED items:

  1. ref token format (both files): Updated all remaining ref:GH# occurrences to ref=GH# (equals sign, matching claim-task-id.sh output). Added ref=GL# for GitLab where relevant. Commit: 35316e8.

  2. Conditional gh issue create (both files): Already addressed in prior commits (27f65cf, 1dba97a). The wording now explicitly states gh issue create should only run when claim-task-id.sh was invoked with --no-issue or its output did not include a ref=GH#/ref=GL# token.

All 4 inline CodeRabbit comments addressed. CI should pass on re-run.

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Mar 4 23:16:22 UTC 2026: Code review monitoring started
Wed Mar 4 23:16:22 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 107

📈 Current Quality Metrics

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

Generated on: Wed Mar 4 23:16:25 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

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

Labels

enhancement Auto-created from TODO.md tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supervisor self-improvement creates tasks in wrong repo (no repo routing)

1 participant