Skip to content

Commit d5c6607

Browse files
committed
feat: disable compiler skill publishing
1 parent 910d580 commit d5c6607

6 files changed

Lines changed: 115 additions & 30 deletions

File tree

‎src/codex_self_evolution/compiler/backends.py‎

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,35 @@ class CompilerBackend(Protocol):
9595
def compile(self, batch: list[SuggestionEnvelope], context: dict[str, Any], options: dict[str, Any]) -> CompileArtifacts: ...
9696

9797

98+
def _discard_disabled_skill_actions(batch: list[SuggestionEnvelope]) -> list[dict[str, Any]]:
99+
discarded: list[dict[str, Any]] = []
100+
for envelope in batch:
101+
for suggestion in envelope.suggestions:
102+
if suggestion.family == "skill_action":
103+
discarded.append({
104+
"summary": suggestion.summary,
105+
"reason": "skill_action_disabled",
106+
"detail": "compiler no longer produces skills; use skill-synthesize",
107+
})
108+
return discarded
109+
110+
111+
def _disable_compiler_skill_outputs(
112+
parsed: dict[str, Any],
113+
batch: list[SuggestionEnvelope],
114+
context: dict[str, Any],
115+
) -> dict[str, Any]:
116+
return {
117+
**parsed,
118+
"compiled_skills": [],
119+
"manifest_entries": list(context.get("existing_manifest") or []),
120+
"discarded_items": [
121+
*list(parsed.get("discarded_items") or []),
122+
*_discard_disabled_skill_actions(batch),
123+
],
124+
}
125+
126+
98127
class AgentCompileError(RuntimeError):
99128
def __init__(
100129
self,
@@ -128,9 +157,9 @@ def compile(self, batch: list[SuggestionEnvelope], context: dict[str, Any], opti
128157
thread_id=batch[0].thread_id if batch else "",
129158
existing_records=context.get("existing_recall_records"),
130159
)
131-
compiled_skills, discarded_items = compile_skills(all_suggestions, existing_entries=existing_manifest)
132-
discarded_items = [*recall_discarded, *discarded_items]
133-
manifest_entries = build_manifest_entries(compiled_skills, context["skills_dir"], existing_entries=existing_manifest)
160+
compiled_skills: list[dict[str, Any]] = []
161+
discarded_items = [*recall_discarded, *_discard_disabled_skill_actions(batch)]
162+
manifest_entries: list[SkillManifestEntry] = list(existing_manifest)
134163
return CompileArtifacts(
135164
memory_records=memory_records,
136165
recall_records=recall_records,
@@ -210,6 +239,7 @@ def compile(self, batch: list[SuggestionEnvelope], context: dict[str, Any], opti
210239
last_reason = "agent_output_invalid"
211240
last_detail = _truncate(str(exc))
212241
continue
242+
parsed = _disable_compiler_skill_outputs(parsed, batch, context)
213243
empty_output_reason = _agent_empty_output_reason(batch, context, parsed)
214244
if empty_output_reason:
215245
last_reason = empty_output_reason
@@ -373,6 +403,7 @@ def _compile_with_edit_workspace(
373403
last_reason = "agent_output_invalid"
374404
last_detail = _truncate(str(exc))
375405
continue
406+
parsed = _disable_compiler_skill_outputs(parsed, batch, context)
376407
empty_output_reason = _agent_empty_output_reason(batch, context, parsed)
377408
if empty_output_reason:
378409
last_reason = empty_output_reason

‎src/codex_self_evolution/compiler/engine.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def run_compile(
337337
compiled_skills=artifacts.compiled_skills,
338338
manifest_entries=artifacts.manifest_entries,
339339
existing_entries=context["existing_manifest"],
340-
publish_global_skills_enabled=True,
340+
publish_global_skills_enabled=False,
341341
)
342342
item_receipts = []
343343
item_receipts.extend(noop_item_receipts)
@@ -457,7 +457,7 @@ def _compile_claimed_individually(
457457
compiled_skills=artifacts.compiled_skills,
458458
manifest_entries=artifacts.manifest_entries,
459459
existing_entries=context["existing_manifest"],
460-
publish_global_skills_enabled=True,
460+
publish_global_skills_enabled=False,
461461
)
462462
last_skill_publish = output_paths["skills"][2]
463463
compiler_observability = artifacts.compiler_observability or compiler_observability

‎src/codex_self_evolution/review/prompt.md‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You are a memory/skills curator. Review the completed turn and emit at most thre
44

55
- `memory_updates`: durable facts worth carrying into future sessions
66
- `recall_candidate`: context that future turns could retrieve on demand
7-
- `skill_action`: candidate managed skills to create, patch, edit, or retire
7+
- `skill_action`: deprecated; return an empty array for this field
88

99
## How to read the input
1010

@@ -13,7 +13,7 @@ The input object gives you everything you need:
1313
- `turn_snapshot.transcript` / `thread_read_output`: what happened this turn
1414
- `comparison_materials.current_memory_md`: the MEMORY.md that is **already saved for this repo**. Treat this as authoritative — you must check it before proposing any `memory_updates` with `scope: "global"`.
1515
- `comparison_materials.current_user_md`: the USER.md that is already saved. Same rule for `scope: "user"`.
16-
- `comparison_materials.managed_skills_summary`: existing managed skills.
16+
- `comparison_materials.managed_skills_summary`: legacy managed skills.
1717

1818
If a proposed entry says the same thing as an existing entry, you must either emit `action: "replace"` to update the existing one or skip it. **Do not emit a new `add` that duplicates existing material** — the pipeline's dedup only catches exact character-for-character matches, not semantic near-duplicates.
1919

@@ -85,17 +85,9 @@ For `memory_updates`, `details` must additionally include:
8585
- `action`: `"add"` | `"replace"` | `"remove"` (optional, default `"add"`)
8686
- `old_summary`: required when `action` is `"replace"` or `"remove"`
8787

88-
For `memory_updates` and `recall_candidate`, `details` may additionally include:
89-
90-
- `skill_candidate`: optional object with `skill_id`, `title`, `description`, and `content` when the entry reveals a repeated workflow that should become a managed skill.
91-
92-
For `skill_action`, `details` must additionally include:
93-
94-
- `action`: one of `"create" | "patch" | "edit" | "retire"`
95-
- `skill_id`: short kebab-case id
96-
- `title`: non-empty string
97-
- `description`: concrete trigger description, preferably `This skill should be used when ...`
98-
- `content`: non-empty string
88+
`skill_action` is deprecated. Return an empty array for this field if the
89+
schema still asks for it. Reusable workflow synthesis is handled later by the
90+
periodic `skill-synthesize` command.
9991

10092
## Handling of non-conforming items
10193

‎tests/test_agent_compiler_backend.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,8 @@ def invoker(payload, options):
137137
assert artifacts.backend_name == "agent:opencode"
138138
assert artifacts.fallback_backend is None
139139
assert artifacts.memory_records["user"][0]["content"] == "merged user"
140-
assert artifacts.compiled_skills[0]["skill_id"] == "alpha"
141-
assert (
142-
artifacts.compiled_skills[0]["description"]
143-
== "This skill should be used when compiling alpha workflows."
144-
)
145-
assert artifacts.manifest_entries[0].skill_id == "alpha"
140+
assert artifacts.compiled_skills == []
141+
assert artifacts.manifest_entries == []
146142
assert artifacts.discarded_items == [{"reason": "duplicate"}]
147143
assert artifacts.compiler_observability["backend"] == "agent:opencode"
148144
assert artifacts.compiler_observability["input"]["suggestions"] == 1
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from __future__ import annotations
2+
3+
import json
4+
from pathlib import Path
5+
6+
from codex_self_evolution.compiler.backends import ScriptCompilerBackend, build_compile_context
7+
from codex_self_evolution.compiler.engine import run_compile
8+
from codex_self_evolution.config import build_paths
9+
from codex_self_evolution.schemas import Suggestion, SuggestionEnvelope
10+
from codex_self_evolution.storage import append_pending_suggestion
11+
12+
13+
def _envelope(suggestions: list[Suggestion]) -> SuggestionEnvelope:
14+
return SuggestionEnvelope(
15+
schema_version=1,
16+
suggestion_id="s1",
17+
idempotency_key="i1",
18+
thread_id="t1",
19+
cwd="/repo",
20+
repo_fingerprint="repo",
21+
reviewer_timestamp="2026-05-13T00:00:00Z",
22+
suggestions=suggestions,
23+
source_authority=[],
24+
)
25+
26+
27+
def _skill_suggestion() -> Suggestion:
28+
return Suggestion(
29+
family="skill_action",
30+
summary="create skill",
31+
details={
32+
"action": "create",
33+
"skill_id": "old",
34+
"title": "Old",
35+
"description": "Use when old flow repeats.",
36+
"content": "Workflow steps are old.",
37+
},
38+
)
39+
40+
41+
def test_script_compiler_discards_skill_action_without_outputs(tmp_path: Path) -> None:
42+
paths = build_paths(repo_root=tmp_path, state_dir=tmp_path / "state")
43+
envelope = _envelope([_skill_suggestion()])
44+
context = build_compile_context(paths, [envelope])
45+
46+
artifacts = ScriptCompilerBackend().compile([envelope], context, {})
47+
48+
assert artifacts.compiled_skills == []
49+
assert artifacts.manifest_entries == []
50+
assert artifacts.discarded_items[0]["reason"] == "skill_action_disabled"
51+
52+
53+
def test_run_compile_does_not_write_managed_skill_or_global_projection(tmp_path: Path, monkeypatch) -> None:
54+
monkeypatch.setenv("CSEP_CODEX_SKILLS_DIR", str(tmp_path / "codex-skills"))
55+
repo = tmp_path / "repo"
56+
repo.mkdir()
57+
state = tmp_path / "state"
58+
paths = build_paths(repo_root=repo, state_dir=state)
59+
append_pending_suggestion(paths, _envelope([_skill_suggestion()]))
60+
61+
result = run_compile(repo_root=repo, state_dir=state, backend="script")
62+
63+
assert result["status"] == "success"
64+
assert not (state / "skills" / "managed" / "old.md").exists()
65+
assert not (tmp_path / "codex-skills" / "csep-old").exists()
66+
receipt = json.loads((state / "compiler" / "last_receipt.json").read_text(encoding="utf-8"))
67+
assert receipt["managed_skills"] == 0
68+
assert any(item.get("reason") == "skill_action_disabled" for item in receipt["item_receipts"])

‎tests/test_end_to_end.py‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,16 @@ def fake_agent(self, payload, options):
113113
compile_options={"pi_mode": "json"},
114114
)
115115
assert compile_result["processed_count"] == 1
116-
assert (state / "skills" / "managed" / "test-skill.md").exists()
117-
skill_doc = tmp_path / "codex-skills" / "csep-test-skill" / "SKILL.md"
118-
assert skill_doc.exists()
119-
skill_doc_content = skill_doc.read_text(encoding="utf-8")
120-
assert skill_doc_content.startswith("---\n")
121-
assert "description:" in skill_doc_content
116+
assert not (state / "skills" / "managed" / "test-skill.md").exists()
117+
assert not (tmp_path / "codex-skills" / "csep-test-skill" / "SKILL.md").exists()
122118
assert (state / "memory" / "USER.md").exists()
123119
assert (state / "memory" / "MEMORY.md").exists()
124120
assert "Prefer concise summaries" in (state / "memory" / "USER.md").read_text(encoding="utf-8")
125121
assert "Run focused pytest before full suite" in (state / "memory" / "MEMORY.md").read_text(encoding="utf-8")
126122
receipt = json.loads((state / "compiler" / "last_receipt.json").read_text(encoding="utf-8"))
127123
assert receipt["fallback_backend"] is None
124+
assert receipt["managed_skills"] == 0
125+
assert any(item.get("reason") == "skill_action_disabled" for item in receipt["item_receipts"])
128126
assert (state / "suggestions" / "done").glob("*.json")
129127

130128
trigger = evaluate_recall_trigger("remember focused pytest workflow")

0 commit comments

Comments
 (0)