Skip to content

AICTRL_DISABLE_PROJECT_CONFIG still loads AGENTS.md from .opencode/ and from directories the agent reads #250

Closed

Description

@byapparov

Problem

AICTRL_DISABLE_PROJECT_CONFIG=true stops project config, plugins and the root AGENTS.md lookup, but two paths still load AGENTS.md files from the working directory as instructions:

  1. packages/cli/src/session/instruction.ts:22: globalFiles() always adds <Instance.directory>/.opencode/AGENTS.md. systemPaths() loads it whenever ~/.config/aictrl/AGENTS.md (and AICTRL_CONFIG_DIR/AGENTS.md) is absent, which is the usual case on a CI runner.
  2. packages/cli/src/tool/read.ts:138: InstructionPrompt.resolve() walks up from every file the agent reads and attaches any AGENTS.md it finds below the project root. This is not gated by the flag either.

In a pull request review job the working directory is the PR checkout, so the PR author can add .opencode/AGENTS.md or src/AGENTS.md and steer the run through system-level instructions. The diff itself is still untrusted model input; the gap is that these files get instruction status the caller asked to switch off.

Found in the review of #249. The README workflow now deletes AGENTS.md files before the review step as a workaround.

Expected

With AICTRL_DISABLE_PROJECT_CONFIG set, the harness loads no instruction files from the project directory: not .opencode/AGENTS.md, not nested AGENTS.md next to files the agent reads. Global files (~/.config/aictrl/AGENTS.md, AICTRL_CONFIG_DIR/AGENTS.md) and explicit instructions entries in caller config keep working.

Acceptance criteria

  • globalFiles() only includes <Instance.directory>/.opencode/AGENTS.md when project config is enabled.
  • InstructionPrompt.resolve() returns no project files when project config is disabled.
  • Tests: with the flag set, a project containing .opencode/AGENTS.md and sub/AGENTS.md produces no instruction paths from systemPaths() and no attached instructions when reading sub/file.ts; with the flag unset, behaviour is unchanged.
  • packages/cli/README.md documents which instruction files the flag disables.
  • Once released, the README workflow's find . -name AGENTS.md -delete step can be dropped.

Activity

  1. byapparov commented on Oct 22, 2026

    @byapparov
    MemberAuthor

    Fixed on main through #257 and #255 (merge commit cd994a5). The instruction-discovery fix, regression tests and isolation documentation from #251 are already included; #251 is closed as superseded. This confirms the source fix on main, not publication in a released artifact. Keep the documented deletion workaround until the installed release includes the fix and has been verified.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions