Skip to content

Gate context injection for AI agents (CLAUDE.md / .gate awareness) #53

@jordanpartridge

Description

@jordanpartridge

Idea

Every repo that uses gate should automatically inject context about gate into any AI agent working on it. When an agent (agentctl, Claude Code, etc.) encounters a gate-enabled repo, it should immediately know:

  • What gate is and what it enforces
  • The quality thresholds (coverage %, PHPStan level, style rules)
  • How to run gate locally (`php gate certify`)
  • Tips and tricks (common failure patterns, how to debug)
  • The gate philosophy ("directions for completion" not just "FAIL")

Implementation options

Option A: Gate generates a CLAUDE.md section

Gate's GitHub Action or CLI could generate/inject a section into the repo's CLAUDE.md:

## Quality Gate (Synapse Sentinel)
This repo uses gate for quality enforcement.
- Run: \`php gate certify --coverage=80\`
- Checks: Tests+Coverage, Security Audit, Pest Syntax
- Coverage threshold: 80%
- Fix failures: gate posts actionable prompts on PRs

Option B: .gate/context.md convention

A `.gate/context.md` file that gate reads and agents can discover:

This project uses Synapse Sentinel Gate v2.x
Coverage requirement: 100%
PHPStan level: 6
Before committing: run \`php gate certify\`

Option C: Gate CLI command

`gate context` command that outputs agent-ready context:

php gate context > .claude-gate-context.md

Value

  • Agents stop breaking gate by accident
  • New contributors (human or AI) immediately understand quality bar
  • Consistent gate knowledge across all repos in the ecosystem
  • Reduces CI red → fix → re-push cycles

Considerations

  • Should work with any AI agent tool (Claude Code, agentctl, GitHub Copilot)
  • Keep context concise — agents have limited context windows
  • Auto-detect config from `gate.yml` / `action.yml` / workflow files
  • Include current coverage status if available

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