Skip to content

Commit e0c4bf5

Browse files
committed
config: align workflow conventions with deterministic enforcement
Broaden LLM-to-Java guidance, testing conventions, and update-client cache handling so future instruction work routes deterministic behavior through the runtime and harness.
1 parent 178bd9c commit e0c4bf5

3 files changed

Lines changed: 91 additions & 8 deletions

File tree

.cat/rules/common/naming-conventions.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,28 @@ JSON field names in API output contracts (from Java CLI tools) use **snake_case*
3535
(e.g., `"issue_id"`, `"worktree_path"`, `"target_branch"`). This is consistent with the Configuration Reads
3636
table which already shows `target_branch` and `issue_id` in snake_case.
3737

38+
## Frontmatter Keys
39+
40+
YAML frontmatter keys in all file types (skill SKILL.md, agent `.md`, rule `.md`, test `.md`) use
41+
**hyphen-separated lowercase** (e.g., `main-agent`, `sub-agents`, `effort`, `model`, `argument-hint`).
42+
43+
**Correct (hyphen-separated lowercase):**
44+
```yaml
45+
---
46+
main-agent: true
47+
argument-hint: "<cat_agent_id> <issue_id>"
48+
effort: medium
49+
---
50+
```
51+
52+
**Incorrect (camelCase):**
53+
```yaml
54+
---
55+
mainAgent: true
56+
argumentHint: "<cat_agent_id> <issue_id>"
57+
---
58+
```
59+
3860
## All-Caps Shell Variables
3961

4062
Shell environment variables use **SCREAMING_SNAKE_CASE** per POSIX convention (e.g., `WORKTREE_PATH`,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
paths: ["plugin/**", "client/**"]
3+
---
4+
# Failure Investigation Convention
5+
6+
## Never Assume — Always Investigate
7+
8+
When a test run, build step, or tool invocation fails, **do not assume a cause**. Investigate
9+
the actual failure before taking action or changing code.
10+
11+
Common assumptions that lead to incorrect fixes:
12+
- "The runner timed out" (might be a permission error, missing binary, or API failure)
13+
- "The test scenario is wrong" (might be an infrastructure issue or a real skill defect)
14+
- "It's a transient failure" (might be a consistent bug that needs fixing)
15+
- "The binary is missing" (might be a path resolution error)
16+
17+
## Use `get-history-agent` for Session Failures
18+
19+
When a runner or grader fails (`TC{N}: runner failed` or `TC{N}: grader failed`), use the
20+
`cat:get-history-agent` skill to inspect the session transcript before concluding anything.
21+
22+
**CRITICAL timing**: Act immediately when you see a failure notification — do NOT wait for
23+
the batch to finish. Session files live inside the run worktree's isolated config directory
24+
(`${RUN_WORKTREE}/.cat/config/projects/...`). Once SPRT's cleanup step runs, the worktree
25+
is deleted and the session is unrecoverable.
26+
27+
**Procedure when a runner/grader fails:**
28+
1. Kill SPRT immediately: `kill ${SPRT_PID}`
29+
2. Wait for monitor to stop
30+
3. Find the session:
31+
```bash
32+
ENCODED=$(echo "${RUN_WORKTREE}" | sed 's|[/.]|-|g')
33+
ls "${RUN_WORKTREE}/.cat/config/projects/${ENCODED}/"
34+
```
35+
4. Use `cat:get-history-agent` on the session ID to understand what actually happened
36+
5. Only after reading the session: form a hypothesis and fix
37+
38+
## When Artifacts Are Already Gone
39+
40+
If you missed the failure and the run worktree was cleaned up:
41+
- The session is unrecoverable — acknowledge this explicitly
42+
- Rerun SPRT and kill it immediately on the next failure occurrence
43+
- Do NOT hypothesize a fix based on the missing evidence
44+
45+
## Scope
46+
47+
This applies to all failure types encountered during work:
48+
- SPRT runner/grader failures
49+
- Build failures (`mvn verify` errors)
50+
- Hook failures
51+
- Test assertion failures
52+
53+
The rule is: **read the evidence first, then conclude**.

.cat/rules/include/llm-to-java.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
# LLM-to-Java Extraction Policy
22

3-
**MANDATORY goal:** When adding new features to the plugin or updating existing features, extract as much
4-
logic as possible from LLM skills into Java code. This applies to **all files in the skill's transitive
5-
reference graph**, rooted at `SKILL.md` — including `first-use.md` (loaded by the `SKILL.md` preprocessor
6-
directive), any `.md` file listed in `execution_context`, any referenced concept or rules file, and any
7-
Bash scripts invoked from skill steps.
8-
9-
The aim is to make processes deterministic wherever possible. Only leave in the LLM layer:
3+
**MANDATORY goal:** When adding new features to the plugin or updating existing features, design the
4+
behavior as a whole Claude Code system, not as instruction text alone. Extract as much deterministic logic
5+
as possible from LLM skills, rules, and prompts into Java-backed components. This applies to **all files in
6+
the skill's transitive reference graph**, rooted at `SKILL.md` — including `first-use.md` (loaded by the
7+
`SKILL.md` preprocessor directive), any `.md` file listed in `execution_context`, any referenced concept or
8+
rules file, any Bash scripts invoked from skill steps, and any Claude Code component that can enforce the
9+
same goal more reliably.
10+
11+
The aim is to achieve each instruction file's behavioral goal using the best mix of deterministic and LLM
12+
components. For instruction files and their transitive referenced content, convert deterministic portions to
13+
Java whenever possible to improve reliability and performance. Consider the whole enforcement surface:
14+
pre-tool hooks, post-tool hooks, session/subagent hooks, runtime guards, harness checks, deterministic
15+
graders, schema validators, parsers, command builders, migration utilities, and targeted tests. Only leave
16+
in the LLM layer:
1017
- Contextual decision-making that genuinely requires reasoning
11-
- Text output to the terminal
18+
- User-facing text generation or explanation
19+
- Policy guidance that cannot be enforced without semantic judgment
1220

1321
## What belongs in Java
1422

0 commit comments

Comments
 (0)