Skip to content

Add --no-context-files (-nc) flag to skip AGENTS.md / CLAUDE.md loading #9

@quangdang46

Description

@quangdang46

Add --no-context-files (-nc) flag to skip AGENTS.md / CLAUDE.md loading

Summary

Add a CLI flag that disables automatic loading of AGENTS.md / CLAUDE.md / JCODE.md context files at session start. Useful for: scripts that want a clean baseline, evaluations, reproducing user-reported bugs without their local context, and CI smoke tests.

Reference: pi --no-context-files / -nc.

Why

  • Today every session inherits whatever AGENTS.md chain the cwd produces. Reproducing a bug means temporarily renaming files — error-prone.
  • Required for sound benchmarks of "core jcode behavior" without project-specific overrides.
  • Small, isolated change with no behavioral impact when not set.

Current state in jcode

  • jcode loads AGENTS.md automatically (this very repo's AGENTS.md is consumed every session). No flag turns it off.
  • Grep finds no no_context_files, no-context-files, skip_agents_md.

Implementation checklist

1. CLI flag

  • Add a global flag in src/cli/args.rs:
    /// Skip loading AGENTS.md / CLAUDE.md / JCODE.md context files for this session.
    #[arg(long = "no-context-files", short = 'n', global = true)]
    pub(crate) no_context_files: bool,
    (Choose a non-conflicting short alias; -nc directly is two chars, so prefer the long form.)
  • Plumb through to the existing context loader (src/prompt.rs and/or wherever AGENTS.md is consumed).

2. Env var

  • Honor JCODE_NO_CONTEXT_FILES=1 as an alternate path for scripts.

3. Settings

  • Add an loadContextFiles: bool = true setting in the user/project config so it can be permanently off in CI environments.

4. UX

  • When skipped, log a single line at session start: Context files disabled (--no-context-files). This is critical so users don't get confused why behavior changed.

Testing

Unit

  • With the flag set, the context-file loader returns an empty list even when fixture AGENTS.md is present.
  • Env var path and CLI path both work; CLI overrides settings.

Manual smoke

  • jcode --no-context-files run "What's in AGENTS.md?" — agent has no auto-loaded knowledge of it.

Acceptance criteria

  • Flag works for jcode, jcode run, jcode serve/connect.
  • Documented in --help and README.md.
  • Single-line log entry confirms the flag took effect.

References


Implementation notes addendum (Devin gap-analysis pass, 2026-05-21)

Status

Verified jcode code paths

Acceptance criteria (carry-over from issue #9 original spec; restated for clarity)

  • Both --no-context-files and JCODE_NO_CONTEXT_FILES=1 work (CLI flag overrides env which overrides settings).
  • A single log line Context files disabled (--no-context-files) is emitted on session start when active.
  • Settings supports loadContextFiles: bool = true.
  • --no-context-files works for jcode, jcode run, jcode serve/connect.
  • README and --help updated.
  • Unit tests cover both flag and env-var paths.

Cross-references

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions