Skip to content

Commit f92d108

Browse files
authored
update agents.md (#5606)
1 parent 99978e2 commit f92d108

2 files changed

Lines changed: 158 additions & 99 deletions

File tree

AGENTS.md

Lines changed: 91 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,70 @@
1-
# AGENTS.md
1+
# You are a very strong reasoner and planner. Use these critical instructions to structure your plans, thoughts, and responses.
22

3-
Welcome, AI Agent! Your persistence, curiosity, and craftsmanship make a difference. Take your time, work methodically, validate thoroughly, and iterate. This repository is large and tests can take time — that’s expected and supported.
3+
Before taking any action (either tool calls *or* responses to the user), you must proactively, methodically, and independently plan and reason about:
44

5-
You need to read the entire AGENTS.md file and follow all instructions exactly. Keep this fresh in your context as you work.
5+
1) Logical dependencies and constraints: Analyze the intended action against the following factors. Resolve conflicts in order of importance:
6+
7+
1.1) Policy-based rules, mandatory prerequisites, and constraints.
8+
9+
1.2) Order of operations: Ensure taking an action does not prevent a subsequent necessary action.
10+
11+
1.2.1) The user may request actions in a random order, but you may need to reorder operations to maximize successful completion of the task.
12+
13+
1.3) Other prerequisites (information and/or actions needed).
14+
15+
1.4) Explicit user constraints or preferences.
16+
17+
2) Risk assessment: What are the consequences of taking the action? Will the new state cause any future issues?
18+
19+
2.1) For exploratory tasks (like searches), missing *optional* parameters is a LOW risk.
20+
**Prefer calling the tool with the available information over asking the user, unless** your `Rule 1` (Logical Dependencies) reasoning determines that optional information is required for a later step in your plan.
21+
22+
3) Abductive reasoning and hypothesis exploration: At each step, identify the most logical and likely reason for any problem encountered.
23+
24+
3.1) Look beyond immediate or obvious causes. The most likely reason may not be the simplest and may require deeper inference.
25+
26+
3.2) Hypotheses may require additional research. Each hypothesis may take multiple steps to test.
27+
28+
3.3) Prioritize hypotheses based on likelihood, but do not discard less likely ones prematurely. A low-probability event may still be the root cause.
29+
30+
4) Outcome evaluation and adaptability: Does the previous observation require any changes to your plan?
31+
32+
4.1) If your initial hypotheses are disproven, actively generate new ones based on the gathered information.
33+
34+
5) Information availability: Incorporate all applicable and alternative sources of information, including:
35+
36+
5.1) Using available tools and their capabilities
37+
5.2) All policies, rules, checklists, and constraints
38+
5.3) Previous observations and conversation history
39+
5.4) Information only available by asking the user
40+
41+
6) Precision and Grounding: Ensure your reasoning is extremely precise and relevant to each exact ongoing situation.
42+
43+
6.1) Verify your claims by quoting the exact applicable information (including policies) when referring to them.
44+
45+
7) Completeness: Ensure that all requirements, constraints, options, and preferences are exhaustively incorporated into your plan.
46+
47+
7.1) Resolve conflicts using the order of importance in #1.
48+
49+
7.2) Avoid premature conclusions: There may be multiple relevant options for a given situation.
50+
51+
7.2.1) To check for whether an option is relevant, reason about all information sources from #5.
52+
53+
7.2.2) You may need to consult the user to even know whether something is applicable. Do not assume it is not applicable without checking.
54+
55+
7.3) Review applicable sources of information from #5 to confirm which are relevant to the current state.
56+
57+
8) Persistence and patience: Do not give up unless all the reasoning above is exhausted.
58+
59+
8.1) Don't be dissuaded by time taken or user frustration.
60+
61+
8.2) This persistence must be intelligent: On *transient* errors (e.g. please try again), you *must* retry **unless an explicit retry limit (e.g., max x tries) has been reached**. If such a limit is hit, you *must* stop. On *other* errors, you must change your strategy or arguments, not repeat the same failed call.
62+
63+
9) Inhibit your response: only take an action after all the above reasoning is completed. Once you've taken an action, you cannot take it back.
664

765
---
866

9-
## Read‑Me‑Now: Proportional Test‑First Rule (Default)
67+
## Read‑Me‑Now: Proportional Test‑First Rule
1068

1169
**Default:** Use **test‑first (TDD)** for any change that alters externally observable behavior.
1270

@@ -31,21 +89,17 @@ It is illegal to `-q` when running tests!
3189

3290
## Four Routines: Choose Your Path
3391

34-
**Routine A — Full TDD (Default)**
92+
**Routine A — Full TDD**
3593
**Routine B — Change without new tests (Proportional, gated)**
3694
**Routine C — Spike/Investigate (No production changes)**
3795
**Routine D — ExecPlans: Complex features or significant refactors**
3896

3997
### Decision quickstart
4098

41-
1. **Is ExecPlans required (complex feature, significant refactor or requested by the user)?**
99+
1. **Is ExecPlans required (complex feature, significant refactor, etc. or explicitly requested by the user)?**
42100
**Yes:** **Routine D (ExecPlans)**. Use an ExecPlan (as described in .agent/PLANS.md) from design to implementation.
43101
**No:** continue.
44102

45-
2**Is new externally observable behavior required?**
46-
**Yes:** **Routine A (Full TDD)**. Add the smallest failing test first.
47-
**No:** continue.
48-
49103
3**Does a failing test already exist in this repo that pinpoints the issue?**
50104
**Yes:** **Routine B (Bugfix using existing failing test).**
51105
**No:** continue.
@@ -54,18 +108,24 @@ It is illegal to `-q` when running tests!
54108
**Yes:** **Routine B (Refactor/micro‑perf/documentation/build).**
55109
**No or unsure:** continue.
56110

57-
5**Is this purely an investigation/design spike with no production code changes?**
58-
**Yes:** **Routine C (Spike/Investigate).**
59-
**No or unsure:** **Routine A.**
111+
4. **Is new externally observable behavior required?**
112+
**Yes:** **Routine A (Full TDD)**. Add the smallest failing test first.
113+
**No:** continue.
60114

61-
**When in doubt, choose Routine A (Full TDD).** Ambiguity is risk; tests are insurance.
115+
5. **Is this purely an investigation/design spike with no production code changes?**
116+
**Yes:** **Routine C (Spike/Investigate).**
117+
**No or unsure:** **Routine A.**
62118

63119
---
64120

65121
## ExecPlans
66122

67123
When writing complex features or significant refactors, use an ExecPlan (as described in PLANS.md) from design to implementation.
68124

125+
## ExecPlans
126+
127+
When writing complex features or significant refactors, use an ExecPlan (as described in PLANS.md) from design to implementation.
128+
69129
## PIOSEE Decision Model (Adopted)
70130

71131
Use this as a compact, repeatable loop for anything from a one‑line bug fix to a multi‑quarter program.
@@ -257,12 +317,12 @@ Plan
257317
`-am` is helpful for **compiles**, hazardous for **tests**.
258318
259319
* ✅ Use `-am` **only** for compile/verify with tests skipped (e.g. `-Pquick`):
260-
* `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -am -Pquick install`
320+
* `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -am -Pquick clean install`
261321
* ❌ Do **not** use `-am` with `verify` when tests are enabled.
262322
263323
**Two-step pattern (fast + safe)**
264324
1. **Compile deps fast (skip tests):**
265-
`mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -am -Pquick install`
325+
`mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -am -Pquick clean install`
266326
2. **Run tests:**
267327
`mvn -o -Dmaven.repo.local=.m2_repo -pl <module> verify | tail -500`
268328
@@ -276,9 +336,10 @@ It is illegal to `-q` when running tests!
276336
The Maven reactor resolves inter-module dependencies from the configured local Maven repository (here: `.m2_repo`).
277337
Running `install` publishes your changed modules there so downstream modules and tests pick up the correct versions.
278338
279-
* Always run `mvn -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200` before you start working. This command typically takes up to 30 seconds. Never use a shorter timeout than 30,000 ms.
280-
* Always run `mvn -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200` before any `verify` or test runs.
281-
* If offline resolution fails due to a missing dependency or plugin, rerun the exact `install` command once without `-o`, then return offline.
339+
* Always run `mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200` before you start working. This command typically takes up to 30 seconds. Never use a shorter timeout than 60,000 ms.
340+
* Always run `mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200` before any `verify` or test runs.
341+
* If offline resolution fails due to a missing dependency or plugin, run the command without `-o`: `mvn -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200`, then return offline.
342+
* If it fails for any other reason, run the command without `-T 1C`: `mvn -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200`.
282343
* Skipping this step can lead to stale or missing artifacts during tests, producing confusing compilation or linkage errors.
283344
* Always use a workspace-local Maven repository: append `-Dmaven.repo.local=.m2_repo` to all Maven commands (install, verify, formatter, etc.).
284345
* Always try to run these commands first to see if they run without needing any approvals from the user w.r.t. the sandboxing.
@@ -287,8 +348,8 @@ Why this is mandatory
287348
288349
- Tests must not use `-am`. Without `-am`, Maven will not build upstream modules when you run tests; it will resolve cross‑module dependencies from the configured local repository (here: `.m2_repo`).
289350
- Therefore, tests only see whatever versions were last published to the configured local repo (`.m2_repo`). If you change code in one module and then run tests in another, those tests will not see your changes unless the updated module has been installed to `.m2_repo` first.
290-
- The reliable way to ensure all tests always use the latest code across the entire multi‑module build is to install all modules to the configured local repo (`.m2_repo`) before running any tests: run `mvn -o -Dmaven.repo.local=.m2_repo -Pquick install` at the repository root.
291-
- In tight loops you may also install a specific module and its deps (`-pl <module> -am -Pquick install`) to iterate quickly, but before executing tests anywhere that depend on your changes, run a root‑level `mvn -o -Dmaven.repo.local=.m2_repo -Pquick install` so the latest jars are available to the reactor from `.m2_repo`.
351+
- The reliable way to ensure all tests always use the latest code across the entire multi‑module build is to install all modules to the configured local repo (`.m2_repo`) before running any tests: run `mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install` at the repository root.
352+
- In tight loops you may also install a specific module and its deps (`-pl <module> -am -Pquick clean install`) to iterate quickly, but before executing tests anywhere that depend on your changes, run a root‑level `mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install` so the latest jars are available to the reactor from `.m2_repo`.
292353
---
293354
294355
## Quick Start (First 10 Minutes)
@@ -297,9 +358,9 @@ Why this is mandatory
297358
* Inspect root `pom.xml` and module tree (see “Maven Module Overview”).
298359
* Search fast with ripgrep: `rg -n "<symbol or string>"`
299360
2. **Build sanity (fast, skip tests)**
300-
* `mvn -o -Dmaven.repo.local=.m2_repo -Pquick install | tail -200`
361+
* `mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200`
301362
3. **Format (Java, imports, XML)**
302-
* `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C formatter:format impsort:sort xml-format:xml-format`
363+
* `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C spotless:apply`
303364
4. **Targeted tests (tight loops)**
304365
* Module: `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> verify | tail -500`
305366
* Class: `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -Dtest=ClassName verify | tail -500`
@@ -313,7 +374,7 @@ It is illegal to `-q` when running tests!
313374
314375
---
315376
316-
## Routine A — Full TDD (Default)
377+
## Routine A — Full TDD
317378
318379
> Use for **all behavior‑changing work** and whenever Routine B gates do not all pass.
319380
@@ -406,8 +467,8 @@ When writing complex features or significant refactors, use an ExecPlan (as desc
406467
* **PIOSEE first:** restate Problem, gather Information, list Options; then Select, Execute, Evaluate.
407468
* **Plan:** small, verifiable steps; keep one `in_progress`, or follow PLANS.md (ExecPlans)
408469
* **Change:** minimal, surgical edits; keep style/structure consistent.
409-
* **Format:** `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C formatter:format impsort:sort xml-format:xml-format`
410-
* **Compile (fast):** `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -am -Pquick install | tail -500`
470+
* **Format:** `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C spotless:apply`
471+
* **Compile (fast):** `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -am -Pquick clean install | tail -500`
411472
* **Test:** start smallest (class/method → module). For integration, run module `verify`.
412473
* **Triage:** read reports; fix root cause; expand scope only when needed.
413474
* **Iterate:** keep momentum; escalate only when blocked or irreversible.
@@ -478,7 +539,7 @@ Assertions are executable claims about what must be true. Use **temporary tripwi
478539
479540
* Always run before finalizing:
480541
481-
* `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C formatter:format impsort:sort xml-format:xml-format`
542+
* `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C spotless:apply`
482543
* Style: no wildcard imports; 120‑char width; curly braces always; LF endings.
483544
484545
### Import hygiene (always)
@@ -513,8 +574,8 @@ Do **not** modify existing headers’ years.
513574
514575
## Pre‑Commit Checklist
515576
516-
* **Format:** `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C formatter:format impsort:sort xml-format:xml-format`
517-
* **Compile (fast path):** `mvn -o -Dmaven.repo.local=.m2_repo -Pquick install | tail -200`
577+
* **Format:** `mvn -o -Dmaven.repo.local=.m2_repo -q -T 2C spotless:apply`
578+
* **Compile (fast path):** `mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install | tail -200`
518579
* **Tests (targeted):** `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> verify | tail -500` (broaden as needed)
519580
* **Reports:** zero new failures in Surefire/Failsafe, or explain precisely.
520581
* **Evidence:** Routine A — failing pre‑fix + passing post‑fix.
@@ -629,7 +690,7 @@ Do **not** modify existing headers’ years.
629690
## Build
630691
631692
* **Build without tests (fast path):**
632-
`mvn -o -Dmaven.repo.local=.m2_repo -Pquick install`
693+
`mvn -T 1C -o -Dmaven.repo.local=.m2_repo -Pquick clean install`
633694
* **Verify with tests:**
634695
Targeted module(s): `mvn -o -Dmaven.repo.local=.m2_repo -pl <module> verify`
635696
Entire repo: `mvn -o -Dmaven.repo.local=.m2_repo verify` (use judiciously)
@@ -751,7 +812,6 @@ rdf4j: root project
751812
│ ├── lmdb: Sail implementation that stores data to disk using LMDB.
752813
│ ├── lucene-api: StackableSail API offering full-text search on literals, based on Apache Lucene.
753814
│ ├── lucene: StackableSail implementation offering full-text search on literals, based on Apache Lucene.
754-
│ ├── solr: StackableSail implementation offering full-text search on literals, based on Solr.
755815
│ ├── elasticsearch: StackableSail implementation offering full-text search on literals, based on Elastic Search.
756816
│ ├── elasticsearch-store: Store for utilizing Elasticsearch as a triplestore.
757817
│ └── extensible-store: Store that can be extended with a simple user-made backend.
@@ -791,7 +851,6 @@ rdf4j: root project
791851
├── model: RDF4J: Model compliance tests
792852
├── sparql: Tests for the SPARQL query language implementation
793853
├── lucene: Compliance Tests for LuceneSail.
794-
├── solr: Tests for Solr Sail.
795854
├── elasticsearch: Tests for Elasticsearch.
796855
└── geosparql: Tests for the GeoSPARQL query language implementation
797856
├── examples: Examples and HowTos for use of RDF4J in Java

0 commit comments

Comments
 (0)