git-proxy
AGENTS.md262 starsChanged 2 months agoApache-2.0View on GitHub
GitProxy is a Git HTTP proxy that intercepts Git operations (primarily git push) and enforces organizational policies before allowing changes to reach the actual Git host. The core design principle is a chain-of-processors architecture where each Git action flows through ordered processing steps. Stack: TypeScript, Node >=22, Express 5, React 16, Vitest 3, NeDB / MongoDB GitProxy consists of four main components: Express-based HTTP proxy that: Core concepts: Express application responsible for: Default port: 8080 Authentication strategies supported: Loads and…
- Commits and pushes
We split this AGENTS.md into the rules it gives an agent
22 rules. About 0 are common, 22 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 133
If valid → queued for approval
- Distinctive: line 135
If approved → user re-pushes to actual remote
- Distinctive: line 184
When modifying or adding processors:
- Distinctive: line 195
If a processor requires data not available at the end of the chain, it must be inserted earlier.
- Distinctive: line 205
Should not modify core system invariants
- Distinctive: line 206
Must respect chain ordering semantics
- Distinctive: line 208
If logic needs access to internal chain data before plugins execute, implement a custom processor, not a plugin.
- Distinctive: line 246
If repository clone occurred:
- Distinctive: line 250
Never introduce processor changes that bypass audit logging.
- Distinctive: line 262
When implementing new functionality:
- Distinctive: line 271
Do NOT insert logic randomly in the proxy request handler.
- Distinctive: line 282
Do not mix responsibilities across modules.
- Distinctive: line 302
When introducing new config options:
- Distinctive: line 307
Document in schema reference
- Distinctive: line 309
Never silently change default security behavior.
- Distinctive: line 317
Add to existing processor (if cohesive).
- Distinctive: line 321
Create a new processor.
- Distinctive: line 366
All source files must include the Apache 2.0 license header (see any existing file).
- Distinctive: line 387
The main agent must act as an orchestrator: Never do work inline that can be delegated to a subagent.
- Distinctive: line 389
Delegate everything: Use the Task tool with specialized subagents for all research, code exploration, code writing, testing, and analysis.
- Distinctive: line 394
Hooks run automatically — use subagents to respond: When a hook (Spotless, build verification, code review, or simplification) reports an …
- Distinctive: line 408
All changes must respect that flow.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — GitProxy
Project Overview
GitProxy is a Git HTTP proxy that intercepts Git operations (primarily git push) and enforces organizational policies before allowing changes to reach the actual Git host.
It acts as:
- A policy enforcement engine (via processors and plugins)
- A review/approval gate (manual or automated)
- A proxy server for Git operations
- A UI + API layer for reviewing, approving, and auditing pushes
The core design principle is a chain-of-processors architecture where each Git action flows through ordered processing steps.
Build & Run
# Build
npm run build
# Run unit tests
npm run test
# Run e2e tests
npm run test:e2e
# Lint check/fix
npm run lint
npm run lint:fix
# Format check/fix
npm run format:check
npm run formatStack: TypeScript, Node >=22, Express 5, React 16, Vitest 3, NeDB / MongoDB
High-Level Architecture
GitProxy consists of four main components:
Contributor (git push)
↓
HTTP Proxy (/src/proxy)
↓
Action Chain (Processors + Plugins)
↓
Service API (/src/service)
↓
Database (audit, users, repos, approvals)
↓
Web UI (/src/ui)1. Proxy Server (/src/proxy)
Express-based HTTP proxy that:
- Intercepts Git operations
- Parses requests into an
Action - Executes the appropriate Action Chain
- Blocks, rejects, or queues for approval
Core concepts:
- Action — Represents a Git operation (push/pull/default)
- Chain — Ordered list of processors
- Processor (Step) — A single policy enforcement unit
- Plugin — Custom processor injected externally
2. Service API (/src/service)
Express application responsible for:
- UI communication
- Authentication (Passport strategies)
- Database access
- Approval/rejection workflows
Default port: 8080
Authentication strategies supported:
- Local
- ActiveDirectory
- OpenID Connect
3. Configuration (/src/config)
Loads and validates proxy.config.json.
Controls:
- Authentication methods
- Repository allowlist
- Commit message policies
- Database configuration
- Feature flags
Schema reference: https://git-proxy.finos.org/docs/configuration/reference/
4. Web UI (/src/ui)
React-based UI used to:
- View pending pushes
- Review diffs
- Approve/reject pushes
- Manage repositories/users (depending on role)
Core Architectural Model
Action Lifecycle (Push)
parseActionclassifies requestpushActionChainexecutes processors in strict order- If blocked → rejected
- If valid → queued for approval
- Approver reviews in UI
- If approved → user re-pushes to actual remote
Action Chains
Push Action Chain
parsePush
resolveUserFromToken
checkEmptyBranch
checkRepoInAuthorisedList
checkCommitMessages
checkAuthorEmails
checkUserPushPermission
pullRemote
writePack
checkHiddenCommits
checkIfWaitingAuth
preReceive
getDiff
gitleaks
scanDiff
blockForAuthOrder matters. Some processors depend on artifacts created by previous ones (e.g., cloned repo, computed diff).
Pull Action Chain
checkRepoInAuthorisedListDefault Action Chain
checkRepoInAuthorisedListProcessor Rules
When modifying or adding processors:
- They must be idempotent
- They must clearly define:
- Required inputs
- Side effects
- Failure mode (reject vs throw vs auto-approve)
- They must not mutate shared state outside the
Action - They must preserve audit traceability
If a processor requires data not available at the end of the chain, it must be inserted earlier.
Plugin System
Plugins:
- Extend push/pull chains
- Are externally defined processors
- Should not modify core system invariants
- Must respect chain ordering semantics
If logic needs access to internal chain data before plugins execute, implement a custom processor, not a plugin.
Authentication Model
Authentication applies to:
- UI access
- Approval workflow
- User management
It does NOT authenticate Git pushes via the proxy itself — Git identity is derived from commit metadata (user.email).
Supported methods:
- Local (default)
- ActiveDirectory
- OpenID Connect
New strategies must:
- Extend
/src/service/passport - Provide a
configure()function - Match config
type - Be added to
authStrategiesinindex.ts
Audit Model
After chain execution:
auditstores:- Action metadata
- Processor results
- Approval state
If repository clone occurred:
clearBareClonemust clean up disk artifacts
Never introduce processor changes that bypass audit logging.
Audit integrity is critical.
Development Guidelines for Agents
1. Respect the Chain Architecture
The action chain is the core abstraction.
When implementing new functionality:
- Decide whether it belongs in:
- Existing processor
- New processor
- Plugin
- Service layer
- UI
- Do NOT insert logic randomly in the proxy request handler.
2. Separation of Concerns
- Proxy handles Git interception + chain execution
- Service handles authentication + state
- Config handles validation and schema
- UI handles display + approval user flow
Do not mix responsibilities across modules.
3. Approval Semantics
Important rule:
A push must never reach the real Git remote unless explicitly approved or auto-approved by policy.
Changes must not bypass:
blockForAuth- Approval state checks
- Waiting authorization checks
4. Configuration Safety
When introducing new config options:
- Add schema validation
- Provide sensible defaults
- Ensure backward compatibility
- Document in schema reference
Never silently change default security behavior.
5. Adding New Policies
If simple and configurable:
Add to existing processor (if cohesive).
If complex and reusable:
Create a new processor.
If organization-specific:
Implement as plugin.
Ask:
- Does this require diff access?
- Does this require cloned repo?
- Does this require user database?
- Does this need to run before approval gating?
Testing Expectations
When modifying:
Proxy / Processors
- Must test:
- Success path
- Rejection path
- Audit logging (
step.error,step.log)
Config
- Must test:
- Invalid values
- Default values
Common Pitfalls
- Breaking processor order dependencies
- Mixing UI and service logic
- Introducing security regressions in approval flow
- Mutating global/shared state outside
Action
License Header
All source files must include the Apache 2.0 license header (see any existing file).
Tool Integration
This file is the canonical project guide. Tool-specific entry points:
- Claude Code:
CLAUDE.md(bridge) +.claude/skills/ - GitHub Copilot:
.github/copilot-instructions.md - OpenCode:
.opencode/commands/ - Codex:
AGENTS.md
Database changes
The fs, mongo and postgres sink backends must stay at feature parity. Before changing anything under src/db, read .agents/skills/sink-parity/SKILL.md: apparently simple adaptor changes usually cost more on the postgres side (explicit columns, update allowlists, append-only schema migrations) than on the document stores, and the skill carries the checklist that keeps the backends aligned.
Agent Workflow
The main agent must act as an orchestrator. Never do work inline that can be delegated to a subagent.
- Delegate everything: Use the Task tool with specialized subagents for all research, code exploration, code writing, testing, and analysis. The main agent should plan, coordinate, and summarize — not do the work itself.
- Maximize parallelism: Launch multiple subagents concurrently whenever their tasks are independent. For example, when exploring code patterns AND analyzing tests AND checking dependencies, spawn all three agents in a single message rather than sequentially. Always send independent Task calls in a single message with multiple tool-use blocks.
<!-- - **Use the right agent type:** Pick `Explore` for codebase search/understanding, `Plan` for architecture decisions, `Bash` for commands, and specialized agents (e.g., `code-reviewer`, `test-automator`, `debugger`) when they match the task.
- **Keep the main context clean:** Offload large file reads, multi-file searches, and deep analysis to subagents so the main conversation stays focused on coordination and user communication.
- **Hooks run automatically — use subagents to respond:** When a hook (Spotless, build verification, code review, or simplification) reports an issue, delegate the fix to a subagent rather than doing it inline. If multiple hooks fail simultaneously, spawn parallel subagents to address each issue concurrently. -->Summary
GitProxy is:
- A deterministic policy pipeline
- Wrapped in a Git HTTP proxy
- With an approval gate
- Backed by a service API
- Audited end-to-end
All changes must respect that flow.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- address-reviewSkill
- commitSkill
- docsSkill
- implementSkill
- issueSkill
- lintSkill
- sink-paritySkill
- summarySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

