Skip to content

Commit 64e7089

Browse files
chore(hermes): drop the unreachable review mode
The Hermes plugin only ever builds context from `_current_mode` or the default, and both accept off/lite/full/ultra only, so the review branch, CONFIG_MODES, _normalize_config_mode and REVIEW_SKILL never ran outside a test. Removed them and the test that exercised only that code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9b58c1f commit 64e7089

2 files changed

Lines changed: 4 additions & 37 deletions

File tree

‎__init__.py‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
DEFAULT_MODE = "full"
1212
RUNTIME_MODES = {"off", "lite", "full", "ultra"}
13-
CONFIG_MODES = RUNTIME_MODES | {"review"}
1413
SKILL_COMMANDS = {
1514
"ponytail-review": "Review the current diff or provided target: bugs, security, load, missing tests, speed, and what to cut.",
1615
"ponytail-audit": "Audit the whole repo: bugs, security, load, missing tests, speed, and what to cut.",
@@ -22,7 +21,6 @@
2221
ROOT = Path(__file__).resolve().parent
2322
SKILLS_DIR = ROOT / "skills"
2423
PONYTAIL_SKILL = SKILLS_DIR / "ponytail" / "SKILL.md"
25-
REVIEW_SKILL = SKILLS_DIR / "ponytail-review" / "SKILL.md"
2624

2725
_current_mode = None
2826

@@ -34,13 +32,6 @@ def _normalize_runtime_mode(mode: str | None) -> str | None:
3432
return mode if mode in RUNTIME_MODES else None
3533

3634

37-
def _normalize_config_mode(mode: str | None) -> str | None:
38-
if not isinstance(mode, str):
39-
return None
40-
mode = mode.strip().lower()
41-
return mode if mode in CONFIG_MODES else None
42-
43-
4435
def _config_dir() -> Path:
4536
if os.environ.get("XDG_CONFIG_HOME"):
4637
return Path(os.environ["XDG_CONFIG_HOME"]) / "ponytail"
@@ -110,17 +101,9 @@ def _fallback_instructions(mode: str) -> str:
110101

111102
def build_injected_context(mode: str | None = None) -> str:
112103
"""Return the mode-filtered Ponytail context injected before LLM turns."""
113-
configured = _normalize_config_mode(mode) or _default_mode()
114-
if configured == "off":
104+
effective = _normalize_runtime_mode(mode) or _default_mode()
105+
if effective == "off":
115106
return ""
116-
if configured == "review":
117-
try:
118-
body = REVIEW_SKILL.read_text(encoding="utf-8")
119-
return f"PONYTAIL MODE ACTIVE — level: review\n\n{_strip_frontmatter(body)}"
120-
except OSError:
121-
return "PONYTAIL MODE ACTIVE — level: review. Review the diff for bugs, risks, load, missing tests, speed and bloat; explain each finding in plain English."
122-
123-
effective = _normalize_runtime_mode(configured) or DEFAULT_MODE
124107
try:
125108
body = PONYTAIL_SKILL.read_text(encoding="utf-8")
126109
return f"PONYTAIL MODE ACTIVE — level: {effective}\n\n{_filter_skill_body_for_mode(body, effective)}"

‎tests/hermes-plugin.test.js‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ print(json.dumps(mod._pre_llm_call()))
177177
}
178178
});
179179

180-
test('Hermes rejects review as a default while keeping explicit review mode', () => {
180+
test('Hermes treats review as a command, never a level', () => {
181181
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ponytail-review-default-'));
182182
fs.mkdirSync(path.join(tmp, 'ponytail'), { recursive: true });
183183
fs.writeFileSync(path.join(tmp, 'ponytail', 'config.json'), JSON.stringify({ defaultMode: 'review' }));
@@ -199,23 +199,7 @@ print(json.dumps({
199199
const data = JSON.parse(output);
200200
assert.match(data.env_default, /PONYTAIL MODE ACTIVE — level: full/);
201201
assert.match(data.file_default, /PONYTAIL MODE ACTIVE — level: full/);
202-
assert.match(data.explicit_review, /PONYTAIL MODE ACTIVE — level: review/);
203-
});
204-
205-
test('Hermes plugin review mode injects the real review skill body', () => {
206-
const output = python(String.raw`
207-
import importlib.util, json
208-
spec = importlib.util.spec_from_file_location('ponytail_hermes_plugin', '__init__.py')
209-
mod = importlib.util.module_from_spec(spec)
210-
spec.loader.exec_module(mod)
211-
ctx = mod.build_injected_context('review')
212-
print(json.dumps({'ctx': ctx}))
213-
`);
214-
const { ctx } = JSON.parse(output);
215-
assert.match(ctx, /PONYTAIL MODE ACTIVE — level: review/);
216-
assert.match(ctx, /Review a change like the senior developer/);
217-
assert.match(ctx, /Verdict: Ship\./);
218-
assert.doesNotMatch(ctx, /^---/);
202+
assert.match(data.explicit_review, /PONYTAIL MODE ACTIVE — level: full/);
219203
});
220204

221205
test('Hermes /ponytail command changes mode and pre_llm_call injects current context', () => {

0 commit comments

Comments
 (0)