Skip to content

feat(init): detect agentrc and suggest it in Next Steps #518

@danielmeppiel

Description

@danielmeppiel

Why

APM and agentrc are complementary tools: agentrc generates tailored agent instructions from real code analysis, APM distributes and governs them across teams. The agentrc side already bridges to APM — agentrc init detects APM and offers to run apm init (agentrc PR #94, merged).

The reverse bridge is missing. Developers who discover APM first should learn about agentrc at the right moment: when they just initialized a project and have no agent instructions yet.

What

After apm init creates apm.yml, the "Next Steps" panel should contextually suggest agentrc — not as a prompt or subprocess call, but as an informational next step alongside the existing ones.

Behavior matrix

State What changes
agentrc in PATH + no instructions exist First next step becomes: Generate agent instructions: agentrc init
agentrc not in PATH + no instructions exist Tip line after the panel: Tip: use agentrc to generate tailored agent instructions from your codebase. https://github.com/microsoft/agentrc
Instructions already exist (.github/copilot-instructions.md, AGENTS.md, etc.) No mention — we do not presume how they got there
--yes mode Next step text included in output (informational, no interaction)

Why "Next Steps" and not a prompt

APM init is fast and deterministic — no LLM calls, no network beyond git config detection. Running agentrc init as a subprocess would take 30-60s (Copilot SDK calls) and break the flow. A next step is a suggestion the user acts on when ready. Same pattern as npm scaffolders printing what to do next.

How

~30 lines in src/apm_cli/commands/init.py:

  1. Add detection helper:
import shutil
from pathlib import Path

def _detect_agentrc(project_root: Path) -> tuple[bool, bool]:
    """Returns (agentrc_installed, has_instructions)."""
    installed = shutil.which("agentrc") is not None
    has_instructions = any([
        (project_root / ".github" / "copilot-instructions.md").exists(),
        (project_root / "AGENTS.md").exists(),
        (project_root / ".github" / "instructions").is_dir(),
    ])
    return installed, has_instructions
  1. Modify next steps building (around line 134-157) to conditionally prepend the agentrc step.

  2. Add tip after the panel when agentrc not installed and no instructions found.

No new dependencies, no prompts, no subprocess calls.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions