Skip to content

feat(core): load provider-specific instruction files (CLAUDE.md, AGENTS.md, GEMINI.md, zeph.md) #1122

@bug-ops

Description

@bug-ops

Problem

Zeph's system prompt is fully hardcoded in crates/zeph-core/src/context.rs. There is no mechanism to load project-specific instruction files at runtime, and no support for the instruction file conventions used by other AI coding agents.

Different providers and tools use different standard filenames:

Provider / Tool Standard file(s)
Claude / Claude Code CLAUDE.md, .claude/CLAUDE.md, .claude/rules/*.md
OpenAI Codex AGENTS.md, AGENTS.override.md
Gemini CLI GEMINI.md
Cursor IDE .cursorrules (deprecated), .cursor/rules/*.mdc
Aider CONVENTIONS.md
Open standard AGENTS.md (agentsmd.net)
Zeph-native zeph.md, .zeph/zeph.md

When developers have these files in their repo (which most do), Zeph ignores them — missing critical project-specific context that other agents receive.

Proposed Solution

1. Auto-detection by active provider

On startup, InstructionLoader scans CWD for provider-standard files based on the active llm.provider and orchestrator providers:

Provider kind Files checked (priority order)
claude CLAUDE.md, .claude/CLAUDE.md, .claude/rules/*.md
openai AGENTS.override.md, AGENTS.md
gemini GEMINI.md
ollama / candle AGENTS.md, zeph.md
(always) zeph.md, .zeph/zeph.md

When multiple providers are active (orchestrator), the union of detected files is loaded with deduplication.

2. Config options

[agent]
instruction_auto_detect = true   # enable auto-detection (default: true)
instruction_files = []           # explicit list overrides auto-detect

[llm]
instruction_file = ""            # per-provider override

[orchestrator.providers.<name>]
instruction_file = ""            # per-orchestrator-provider override

3. System prompt injection

Instruction file content is injected between the static preamble and the skills block:

[static preamble]
[instruction file blocks — one per file, with source path header]
[skills XML block]
[tool catalog]

Implementation Plan

  1. zeph-core/src/instructions.rs — new InstructionLoader module
    • load_instructions(config, provider_kinds) -> Vec<InstructionBlock>
    • InstructionBlock { source: PathBuf, content: String }
  2. zeph-core/src/context.rs — add instructions: &[InstructionBlock] to build_system_prompt()
  3. zeph-core/src/config/types.rs — extend AgentConfig, LlmConfig, OrchestratorProviderConfig
  4. zeph-core/src/agent/mod.rs — invoke loader on startup
  5. config/default.toml — document new fields

Full research and design: .local/plan/provider-instruction-files.md

References

Out of Scope

  • Per-directory recursive scanning (Gemini/Codex style) — deferred
  • Hot-reload of instruction files at runtime — separate issue
  • TUI panel to display loaded instruction files — separate issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestllmzeph-llm crate (Ollama, Claude)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions