Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .console/log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Log

## 2026-05-21 — Fix console-context block overwriting repo-owned CLAUDE.md content

bootstrap.py rewrote CLAUDE.md from the open marker to EOF (DOTALL), nuking anything below
the OC block. Fix: add <!-- /console-context --> closing fence; regex now replaces only the
fenced region. All existing CLAUDE.md files migrated to add the closing fence.

## 2026-05-21 — Add ContextLifecycleProtocol to platform group and git watcher

Added contextlifecycleprotocol to platform.yaml group list.
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ The context file contains your current task, guidelines, backlog, log, and runti

After meaningful progress, update `.console/backlog.md` and `.console/log.md`.
Do not edit `.console/.context` directly — it is regenerated at each launch.
<!-- /console-context -->
22 changes: 16 additions & 6 deletions src/operator_console/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ def ensure_claude_md(
extra_files: list[str] | None = None,
) -> None:
claude_md = repo_root / "CLAUDE.md"
marker = "<!-- console-context -->"
marker = "<!-- console-context -->"
end_marker = "<!-- /console-context -->"

extra_lines = ""
if extra_files:
Expand Down Expand Up @@ -345,15 +346,24 @@ def ensure_claude_md(

After meaningful progress, update `.console/backlog.md` and `.console/log.md`.
Do not edit `.console/.context` directly — it is regenerated at each launch.
"""
{end_marker}"""
if claude_md.exists():
import re
existing = claude_md.read_text(encoding="utf-8")
if marker in existing:
# Replace existing marked block
if marker in existing and end_marker in existing:
# Replace only the fenced managed block; preserve content outside it
new_text = re.sub(
r"<!-- console-context -->.*?<!-- /console-context -->",
block,
existing,
flags=re.DOTALL,
)
claude_md.write_text(new_text.rstrip() + "\n", encoding="utf-8")
elif marker in existing:
# Old format without closing fence — replace to end of file, append tail if any
new_text = re.sub(
r"<!-- console-context -->.*",
block.strip(),
block,
existing,
flags=re.DOTALL,
)
Expand All @@ -362,7 +372,7 @@ def ensure_claude_md(
# Old format without marker — replace from that heading onward
new_text = re.sub(
r"## OperatorConsole Context.*",
block.strip(),
block,
existing,
flags=re.DOTALL,
)
Expand Down
Loading