Gate Neutralization Mechanism in no-mistakes: How It Protects Repository Secrets
The gate neutralization mechanism is a fail‑closed safety check that verifies an agent can suppress project‑level instruction files before allowing execution when a repository has opted out of its own agent settings.
When using the kunchenguid/no‑mistakes execution daemon, repositories can elect to disable their local project instructions to prevent leakage of sensitive configuration. The gate neutralization mechanism ensures that only adapters with verified capability to neutralize those instructions—currently Codex and Claude—are permitted to run, blocking all others with a clear error.
Why Gate Neutralization Exists
Repositories often contain sensitive directives in AGENTS.md or CLAUDE.md files that should remain confidential. When a repository sets disable_project_settings=true (or DisableProjectSettings in configuration), the daemon must prevent any agent from reading or acting upon these instruction files.
The gate neutralization mechanism enforces a fail‑closed policy: unless an adapter explicitly implements the GateInstructionNeutralizer interface and reports that it can suppress project instructions, it is rejected. This prevents unverified harnesses from inadvertently accessing secret project settings during pipeline execution.
How the Gate Neutralization Mechanism Works
The implementation spans the agent package and the daemon’s run manager, creating a verification layer that executes before any pipeline agent launches.
Core Interface and Verification Logic
In internal/agent/agent.go, the mechanism centers on two key functions and an interface:
GateInstructionNeutralizerinterface: Requires implementing adapters to provide aNeutralizesGateInstructions() boolmethod.NeutralizesGateInstructions(lines 42‑53): A helper that performs a type assertion to check if the agent implements the interface and returns the neutralization status.EnsureGateNeutralized(lines 155‑172): The enforcement function that returns an error if the provided agent does not implement the interface or reportsfalsefor neutralization capability.
// Verification example from the source
if !agent.NeutralizesGateInstructions(ag) {
return errors.New("agent does not neutralize gate instructions")
}
Enforcement in the Daemon
The actual gate check occurs in internal/daemon/manager.go (lines 64‑74). When constructing pipeline agents, the run manager conditionally invokes the neutralization check:
// Simplified logic from manager.go
ag, err := newPipelineAgent(ctx, cfg, exec.LookPath)
if err != nil {
return "", err
}
if cfg.DisableProjectSettings {
// Abort if the agent cannot neutralize project instructions
if err := agent.EnsureGateNeutralized(ag); err != nil {
// Error recorded as "gate_not_neutralized"
return "", err
}
}
If the check fails, the run aborts immediately and logs the failure as gate_not_neutralized, ensuring no unverified agent executes with access to disabled project settings.
Verified Adapters and Implementation
Currently, only the Codex and Claude adapters are verified to neutralize gate instructions. These adapters implement the GateInstructionNeutralizer interface and return true when their respective suppression knobs are active.
To implement gate neutralization for a new adapter, you must satisfy the interface:
type MyAdapter struct {
neutralizes bool // true only when verified suppression is active
}
func (a *MyAdapter) NeutralizesGateInstructions() bool {
return a.neutralizes
}
func NewMyAdapter(opts agent.Options) (agent.Agent, error) {
// Determine if the suppression knob is active
neutralizes := opts.DisableProjectSettings && knobEnabled(opts.AgentArgs)
return &MyAdapter{neutralizes: neutralizes}, nil
}
The adapter must only report true when it can provably suppress reading of AGENTS.md and CLAUDE.md files.
Testing the Gate Neutralization Mechanism
The no‑mistakes codebase includes comprehensive test coverage to ensure the gate behaves correctly under all conditions.
Unit tests in internal/agent/gateneutralize_test.go verify:
- Only Codex and Claude report
NeutralizesGateInstructions() == truewhen opt‑out is enabled (TestNeutralizesGateInstructions_OnlyVerifiedHarnessesUnderOptOut, lines 21‑36). EnsureGateNeutralizedrejects unsupported and nil agents under opt‑out (TestEnsureGateNeutralized_RefusesUnsupportedUnderOptOut, lines 68‑86).
Integration tests in internal/daemon/gateneutralize_test.go confirm the production flow: when DisableProjectSettings is true, only verified harnesses pass through the manager and are marked as neutralized (TestNewPipelineAgent_OptOut_AdmitsVerifiedHarness, lines 17‑30).
Summary
- Gate neutralization is a security check that runs before pipeline agent execution when
disable_project_settings=true. - It verifies that agents implement the
GateInstructionNeutralizerinterface and can suppress project instruction files. - Only Codex and Claude adapters are currently verified; all others are rejected with a
gate_not_neutralizederror. - The check is implemented in
internal/agent/agent.goand enforced by the daemon ininternal/daemon/manager.go. - Comprehensive unit and integration tests ensure the mechanism maintains its fail‑closed behavior across code changes.
Frequently Asked Questions
What happens if an unverified agent tries to run when project settings are disabled?
The daemon calls EnsureGateNeutralized in internal/daemon/manager.go, which detects that the agent does not implement the required interface or returns false. It immediately aborts the run and returns an error logged as gate_not_neutralized, preventing the agent from accessing any repository instruction files.
Why are only Codex and Claude adapters verified for gate neutralization?
These adapters contain verified, tested logic to suppress parsing of AGENTS.md and CLAUDE.md files when the opt‑out flag is active. Other adapters lack proven mechanisms to guarantee this suppression, so the system conservatively rejects them to prevent accidental exposure of sensitive project settings.
How do I implement gate neutralization for a custom adapter?
Implement the GateInstructionNeutralizer interface defined in internal/agent/agent.go by adding a NeutralizesGateInstructions() bool method. Your adapter should only return true when it can provably disable reading of project instruction files, typically by checking the DisableProjectSettings option in the agent configuration along with any adapter‑specific suppression flags.
Where exactly is the gate neutralization check triggered in the execution pipeline?
The check is triggered in internal/daemon/manager.go between lines 64‑74, immediately after the pipeline agent is constructed via newPipelineAgent. This placement ensures the verification happens before any agent code executes, maintaining the confidentiality of disabled project settings throughout the pipeline lifecycle.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →