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
7 changes: 6 additions & 1 deletion src/lore/cli/commands/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,12 @@ def _spawn_subagent(
log_fh = extract_log.open("a", encoding="utf-8")
try:
proc = subprocess.Popen( # noqa: S603 — input is internal, not user-supplied
["claude", "-p", prompt, "--output-format", "stream-json"],
# Claude Code 2.1.x rejects `--print --output-format stream-json`
# without `--verbose`. Without it the subagent exits immediately
# ("When using --print, --output-format=stream-json requires
# --verbose") and the session buffer keeps growing without ever
# being extracted into memories — silent capture-pipeline death.
["claude", "-p", prompt, "--output-format", "stream-json", "--verbose"],
stdin=subprocess.DEVNULL,
stdout=log_fh,
stderr=subprocess.STDOUT,
Expand Down
6 changes: 5 additions & 1 deletion src/lore/cli/commands/dream.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,11 @@ def _spawn_subagent(
log_fh = extract_log.open("a", encoding="utf-8")
try:
return subprocess.Popen( # noqa: S603 — internal prompt
["claude", "-p", prompt, "--output-format", "stream-json"],
# Claude Code 2.1.x rejects `--print --output-format stream-json`
# without `--verbose`. Without it the subagent exits immediately
# with "When using --print, --output-format=stream-json requires
# --verbose" and the buffer never gets extracted into memories.
["claude", "-p", prompt, "--output-format", "stream-json", "--verbose"],
stdin=subprocess.DEVNULL,
stdout=log_fh,
stderr=subprocess.STDOUT,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_capture_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ def __init__(self, cmd, **kwargs):
assert "Help me refactor" in prompt
assert "Already saved A" in prompt
assert "PROCESSED_THROUGH_SEQ=" in prompt
# Claude Code 2.1.x requires --verbose alongside stream-json; without
# it the extraction subagent exits immediately ("requires --verbose")
# and the session buffer keeps growing without ever being extracted
# into memories.
flag_args = cmd[3:]
assert "--output-format" in flag_args
assert "stream-json" in flag_args
assert "--verbose" in flag_args
# Detached invocation hygiene.
assert captured["kwargs"]["stdin"] is subprocess.DEVNULL
assert captured["kwargs"]["start_new_session"] is True
Expand Down
7 changes: 7 additions & 0 deletions tests/test_dreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ def __init__(self, cmd, **kwargs):
prompt = captured["cmd"][2]
assert "PHASE_3_CONSOLIDATE_COMPLETE" in prompt
assert "RUN_ID:" in prompt
# Claude Code 2.1.x requires --verbose alongside stream-json; without
# it the subagent exits immediately and the session buffer never
# gets extracted. Pin the flag so it can't silently regress.
flag_args = captured["cmd"][3:]
assert "--output-format" in flag_args
assert "stream-json" in flag_args
assert "--verbose" in flag_args
# Detached invocation hygiene.
assert captured["kwargs"]["stdin"] is subprocess.DEVNULL
assert captured["kwargs"]["start_new_session"] is True
Expand Down
Loading