Skip to content

fix(doctor): a skills-only install is told to run init --force for a missing AGENTS.md, which installs hooks, agents and settings it skipped #1489

Closed

Description

@admarble

Found during graph-2026-10-freeze-c planning (Phase 0 of node A); not a graph node.

It lands after freeze-c node A, which edits the same file (doctor.ts) and test file and adds the first install-scope read to doctor.

Problem

doctor's AGENTS.md check (src/commands/doctor.ts:678-686) warns whenever a manifest exists and AGENTS.md is absent. The message names sequant init --force. It does not read the install scope (getInstallScope, src/lib/manifest.ts:74).

An install made with init --manifest-only + sync --only skills (groups: ["skills"]) never writes AGENTS.md. So doctor warns on every such install, and the fix it names widens the install.

Reproduced 2026-10-17 (main @ de03af8, dev CLI, temp git repo with a package.json):

  1. sequant init --manifest-only --yes, then sequant sync --only skills. The manifest reads {"version":"2.19.0","groups":["skills"]}. .claude/ holds only skills/.
  2. sequant doctor printed:
    ! AGENTS.md: Missing AGENTS.md - run: sequant init --force (sync never creates a missing AGENTS.md)
    
  3. On a copy, with a hand-written .claude/memory/constitution.md committed, sequant init --force --yes wrote .claude/agents/, .claude/hooks/, .claude/settings.json, .mcp.json, .gitignore, scripts/, AGENTS.md. It changed two skill files and removed groups from the manifest ("groups": null via jq). The constitution was kept.

So the remedy turns a skills-only install into a full install, the outcome #1409 and #1482 exist to prevent.

Acceptance Criteria

  • AC-1: On a manifest with groups: ["skills"] and no AGENTS.md, doctor's AGENTS.md check is not a warning and names no command. Its message says AGENTS.md is outside the skills-only install. Evidence: npx vitest run src/commands/doctor.test.ts -t "missing AGENTS.md on a skills-only install" reports ≥ 1 passed, 0 failed, mutation-verified by restoring the unconditional init --force warning.
  • AC-2: On a manifest without groups (a full install) and no AGENTS.md, the check keeps today's warning and its init --force remedy. Evidence: npx vitest run src/commands/doctor.test.ts -t "missing AGENTS.md on a full install" reports ≥ 1 passed, 0 failed.
  • AC-3: On a manifest with groups: ["skills"], a present AGENTS.md gets today's result: pass when sequant-owned, the fix(sync): never rewrite a user-owned AGENTS.md or write a machine-specific scripts/dev symlink (absorbs #991) #990 user-owned warning otherwise. Evidence: npx vitest run src/commands/doctor.test.ts -t "existing AGENTS.md on a skills-only install" reports ≥ 1 passed, 0 failed, and npx vitest run src/commands/doctor.test.ts -t "990 AC-7" reports 0 failed.

Prior fixes / producers

May touch

src/commands/doctor.ts (the AGENTS.md check), src/commands/doctor.test.ts, CHANGELOG.md.

Non-Goals

  • The Hooks and Settings checks (doctor.ts:688-702, :736-749). They also warn on a skills-only install (No hooks directory (optional but recommended), No settings.json (hooks won't be triggered)), but they name no command, so they don't widen the install. File separately if wanted.
  • The Skills Version remedy and the old-style manifest advice (freeze-c node A).
  • A way to create only AGENTS.md on a skills-only install.
  • Any edit under plugin/, .claude/skills/ or templates/skills/ (plugin freeze).
  • A release.

Activity

  1. added
    bug
    on Oct 17, 2026
  2. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    Complexity: Simple (3 ACs, 1 directory)

    AC Quality Check

    All three ACs are one line with a command-shaped Evidence:. Each -t filter matches no test today, so each fails on the base branch and can pass only once the tests are written. That makes them non-vacuous. AC-1 and AC-2 need exact test titles: missing AGENTS.md on a skills-only install and missing AGENTS.md on a full install. AC-3 also needs existing AGENTS.md on a skills-only install. Note that vitest -t with no match exits 0 or 1 depending on passWithNoTests. Read "≥ 1 passed" literally.

    Scope Assessment

    Non-Goals: present (Hooks and Settings checks, Skills Version remedy, an AGENTS.md-only creator, plugin/skills dirs, release).

    Metric Value Status
    Feature count 1 ✅
    AC items 3 ✅
    Directory spread 1 (src/commands) ✅

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: skills-only, AGENTS.md missing

    Verification: Unit Test (doctor.test.ts)
    Scenario: Given manifest groups:["skills"], readAgentsMd returns null → When doctorCommand() runs → Then the AGENTS.md check is not warn, it names no init --force, and the message says AGENTS.md is outside the skills-only install.

    AC-2: full install, AGENTS.md missing

    Verification: Unit Test
    Scenario: Given a manifest without groups and no AGENTS.md → Then today's warning with the init --force remedy is kept.

    AC-3: skills-only, AGENTS.md present

    Verification: Unit Test
    Scenario: Given groups:["skills"] and AGENTS.md present → Then pass when sequant-owned, the #990 user-owned warning otherwise. The existing "990 AC-7" tests stay green.

    Implementation Plan

    Phase 1: doctor check

    1. src/commands/doctor.ts ~line 717: split the else if (manifest) branch on getInstallScope(manifest).kind.
      • partial: push {name:"AGENTS.md", status:"pass", message:"Not part of the skills-only install (AGENTS.md is outside this install scope)"}. It must not be warn, and the message must carry no command.
      • full: keep the current warning.
    2. Import getInstallScope from ../lib/manifest.js (line 20).

    Phase 2: tests

    1. doctor.test.ts: the vi.mock("../lib/manifest.js") factory (line 36) only provides getManifest and getPackageVersion. Add getInstallScope to the mock. Prefer a real-behaviour stub (m.groups array → partial) so the tests exercise the actual branching. Otherwise the call is undefined and every doctor test throws.
    2. Add the three tests above. Reuse the "legacy skills-only manifest (fix(sync): plain sync and doctor still steer a skills-only install into a full install — sync ignores the recorded scope, doctor names bare sync #1485)" fixture style at line 1613.
    3. Add a CHANGELOG.md entry.
    4. Mutation-verify AC-1: restore the unconditional warning, confirm the AC-1 test fails, restore. Record Mutation-verified: AC-1 — <mutation>; src/commands/doctor.test.ts > ... failed; restored. in the PR body, with the path as the first segment.

    Design Review

    1. Where does this logic belong? In the AGENTS.md check in doctor.ts. getInstallScope is the single reader of scope.
    2. Simplest correct approach? Branch on scope.kind. Rejected: checking whether .claude/hooks etc. exist (heuristic, fix(sync): plain sync and doctor still steer a skills-only install into a full install — sync ignores the recorded scope, doctor names bare sync #1485 already handled legacy manifests that way); rejected: silencing the check entirely, because a full install should still be warned.
    3. Existing pattern / re-patch count? It follows fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409/fix(sync): plain sync and doctor still steer a skills-only install into a full install — sync ignores the recorded scope, doctor names bare sync #1485 scope-gating of doctor advice. git log -S 'init --force' -- src/commands/doctor.ts finds only 3bdfbf1 (Generate and consume AGENTS.md for cross-tool compatibility #371). The issue records that there is one producer, so it is deliberately local. The scope-ignoring class is already tracked in fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409/feat(update): respect the manifest's install scope — update on a skills-only install installs hooks, agents and settings.json #1482/fix(sync): plain sync and doctor still steer a skills-only install into a full install — sync ignores the recorded scope, doctor names bare sync #1485.
    4. Reviewer challenge: "Why pass rather than omitting the check?" Answer: the AC requires a message saying AGENTS.md is outside the install. "Why does a partial scope with other groups also skip?" Today InstallGroup is only "skills". If groups ever add an AGENTS.md group, revisit it. Consider gating on !groups.includes(...) only then.

    Feature Quality Planning

    All standard checks pass. Notables:

    Open Questions

    1. Pass or info status for the skills-only case? Recommendation: pass (the AC says "not a warning"). Impact: cosmetic only.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: Single-file bug fix with bug label and three unit-test ACs. Declared evidence is vitest unit tests, but the bug-only label rule skips testgen.

    Label Review

    Current: bug. Recommended: bug, no change. Quality Loop: won't auto-enable.

    → gh issue edit 1489 --add-label planned

  3. added
    planned
    on Oct 18, 2026
  4. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 3/3 met

    Gaps:

    • AC-1 mutation result is not recorded; add the Mutation-verified line and SEQUANT_MUTATION marker to exec's final Summary
    • Legacy skills-only manifest gets contradictory advice; AC-2 keeps this by design, so it is a follow-up candidate, not an AC gap
    • Hooks/Settings warnings on skills-only installs are deferred by the issue with 'file separately if wanted'
    • Partial-scope AGENTS.md message wording assumes the skills group; consider scope-neutral wording

    Suggestions:

    • A manifest with groups: [] (init --manifest-only before any sync --only) also reads as partial. It gets the message "Not part of the skills-only install", but nothing is installed yet. The behavior is correct. The wording could be scope-neutral.
    • The formatSkillsOutdatedMessage(...) re-wrap at doctor.ts:668 is a Prettier-only change that this issue did not need. It is harmless.
  5. added a commit that references this issue on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions