Skip to content

Commit 6a5c186

Browse files
committed
feat: add agent operating guide and ORCID normalization utilities
1 parent 380f25f commit 6a5c186

File tree

5 files changed

+618
-100
lines changed

5 files changed

+618
-100
lines changed

AGENTS.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Agent Operating Guide for git-metadata-extractor
2+
3+
## Title + Purpose
4+
This guide defines the operating contract for autonomous and semi-autonomous coding agents working in this repository.
5+
The goal is safe, reproducible contributions with minimal human back-and-forth.
6+
7+
## Project Snapshot
8+
- Language/runtime: Python project with package code under `src/`.
9+
- Main runtime surfaces:
10+
- API: `src/api.py`
11+
- CLI: `src/main.py`
12+
- Analysis orchestration: `src/analysis/`
13+
- Agent pipelines: `src/agents/`
14+
- Data models/contracts: `src/data_models/`
15+
- Tests: `tests/`
16+
- Core references:
17+
- `README.md`
18+
- `docs/AGENT_STRATEGY.md`
19+
20+
## Environment & Prerequisites
21+
Required environment variables (from `.env.dist` and `.env.example`):
22+
- `OPENAI_API_KEY`
23+
- `OPENROUTER_API_KEY`
24+
- `GITHUB_TOKEN`
25+
- `GITLAB_TOKEN`
26+
- `INFOSCIENCE_TOKEN`
27+
- `MODEL`
28+
- `PROVIDER`
29+
- `SELENIUM_REMOTE_URL`
30+
- `CACHE_DB_PATH`
31+
- `MAX_SELENIUM_SESSIONS`
32+
- `MAX_CACHE_ENTRIES`
33+
- `GUNICORN_CMD_ARGS`
34+
35+
Rules:
36+
- Never print, log, or commit secrets.
37+
- Never modify secret-bearing files (`.env`, `.env2`, similar secret files) unless explicitly asked.
38+
- If required variables are missing for the requested task, fail fast and report exactly which variables are missing.
39+
40+
## Canonical Commands
41+
`justfile` is the source of truth for routine operations. Prefer `just` commands over ad-hoc shell commands when equivalent recipes exist.
42+
43+
- Setup:
44+
- `just install-dev`
45+
- `just setup`
46+
- Run API:
47+
- `just serve-dev`
48+
- `just serve`
49+
- Tests:
50+
- `just test`
51+
- `just test-file tests/<file>.py`
52+
- Quality:
53+
- `just lint`
54+
- `just type-check`
55+
- `just check`
56+
- CI-like local validation:
57+
- `just ci`
58+
59+
## Architecture Map For Agents
60+
- Repository analysis flow entrypoints: `src/analysis/repositories.py`
61+
- User and organization analysis entrypoints:
62+
- `src/analysis/user.py`
63+
- `src/analysis/organization.py`
64+
- Agent implementations:
65+
- `src/agents/`
66+
- Atomic subpipeline: `src/agents/atomic_agents/`
67+
- Data contracts:
68+
- `src/data_models/`
69+
- Context and external lookups:
70+
- `src/context/`
71+
- Cache layer:
72+
- `src/cache/`
73+
74+
## Editing Rules (Strict)
75+
- Keep diffs minimal and scoped to the requested task.
76+
- Preserve existing code style, project conventions, and import patterns.
77+
- Do not rename or move public modules unless explicitly requested.
78+
- Do not modify `.env`, `.env2`, or other secret-bearing files unless explicitly requested.
79+
- Never run destructive git/file operations unless explicitly requested.
80+
- If unrelated local changes exist, do not revert them; work around them and report context in the completion summary.
81+
82+
## Task Playbooks
83+
### Bug Fix Playbook
84+
1. Reproduce the issue with a targeted test (or nearest equivalent validation).
85+
2. Patch the minimal root cause.
86+
3. Run focused tests first; run broader checks if shared paths were touched.
87+
4. Report behavior change and residual risk.
88+
89+
### Feature Playbook
90+
1. Identify API/data-model impact before coding.
91+
2. Implement required model, pipeline, and endpoint wiring.
92+
3. Add or adjust tests in `tests/`.
93+
4. Validate with `just test` plus relevant lint/type checks.
94+
95+
### Refactor Playbook
96+
1. Preserve behavior unless behavior change is explicitly requested.
97+
2. Keep API contracts stable.
98+
3. Prove parity with tests and checks.
99+
100+
## Testing & Validation Requirements
101+
Minimum before completion:
102+
- Run the nearest relevant tests.
103+
- Run lint/type checks for touched Python modules when feasible.
104+
105+
If validation cannot be completed (missing dependencies, missing env vars, time constraints, external service constraints), report:
106+
- What was attempted.
107+
- What failed and why.
108+
- The exact command(s) to run later.
109+
110+
## API/Schema Change Rules
111+
For changes to FastAPI endpoints in `src/api.py`, include:
112+
- Updated request/response behavior notes.
113+
- Compatibility or migration notes.
114+
- Test coverage for changed endpoint behavior.
115+
116+
For changes to models in `src/data_models/`, include:
117+
- Impact notes on downstream usage (`src/analysis/`, `src/agents/`, API surface).
118+
- Tests for new/changed fields and validation behavior.
119+
120+
## Output/Reporting Contract For Agents
121+
Completion reports must include:
122+
- Files changed
123+
- Behavior change
124+
- Commands run and key results
125+
- Risks / follow-ups
126+
127+
No vague "done" messages. Reports must include verifiable evidence.
128+
129+
## Definition of Done
130+
- Requested scope implemented.
131+
- Relevant tests/checks passed, or blockers explicitly documented.
132+
- No secret leakage.
133+
- No unrelated mutations.
134+
- No undocumented behavior changes.
135+
136+
## Test Cases & Scenarios For This Guide
137+
1. Discoverability
138+
- Scenario: A new agent opens the repository root.
139+
- Expectation: `AGENTS.md` is present with quick-start commands and architecture map.
140+
141+
2. Fail-fast behavior
142+
- Scenario: A task requires `OPENAI_API_KEY`, but it is missing.
143+
- Expectation: Agent halts and reports the missing variable explicitly; no fabricated results.
144+
145+
3. Workflow consistency
146+
- Scenario: Bug fix in `src/agents/organization_enrichment.py`.
147+
- Expectation: Agent follows the bug-fix playbook and runs targeted tests first.
148+
149+
4. Safety guardrails
150+
- Scenario: Dirty worktree with unrelated changes.
151+
- Expectation: Agent avoids reverting unrelated files and reports context.
152+
153+
5. Reporting quality
154+
- Scenario: Agent completes a task.
155+
- Expectation: Final report includes changed files, commands, outcomes, and risks.
156+
157+
## Public API/Type Impact
158+
- No code/API/type changes are introduced by this document.
159+
- This file defines a repository-local agent policy contract only.

0 commit comments

Comments
 (0)