A user reported this issue
[11:48 AM]Jordan Christensen I've been running claude as a CLI tool in a ralph loop, and either it doesn't generate traces, or you can't see them. Anything I can do to help there?
[11:50 AM]Tarun Sachdeva does ralph loop use the claude code sdk
[11:50 AM]i don't really know how it works tbh
[11:52 AM]we look for things in the .claude directory, and if ralp stores them elsewhere we might not find them
[11:52 AM]Jordan Christensen I'm using this one https://github.com/thebigjc/portableralph - it was a little buggy, so I have a PR up with a fix, but this version works for me. It runs claude -p which is:
-p, --print Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with
the -p mode. Only use this flag in directories you trust.and:
--output-format <format> Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime
streaming) (choices: "text", "json", "stream-json")(stream-json is what I enabled because it looked like it was just sitting there)
[11:52 AM]it's possible it doesn't write to .claude when you run it that way?
[11:53 AM]Tarun Sachdeva ohhhh yeah that's probably it
[11:53 AM]great great find thank you
[11:53 AM]i'll add a ticket and push an update tonight
[11:53 AM]feels easy enough to fix
[11:55 AM]Jordan Christensen I'm not sure where else it's writing to, so I hope there is something you can harvest
[11:55 AM]Tarun Sachdeva the thing is, if its running claude, claude should find them
[11:56 AM]i see some of your traces with ralph loop messages, we have to parse those out on the frontend for readability
[11:57 AM]Jordan Christensen Interesting. I ran like 30 iterations over night and I see no additional traces.
[11:57 AM]Tarun Sachdeva you're saying you're not seeing them in the TUI at all
[11:57 AM]interesting
[11:57 AM]Jordan Christensen image.png [11:57 AM]I was going to bug you for a 'upload all the things' button if they were all there
[11:58 AM]but none were[11:58 AM]
They use ralph, https://github.com/snarktank/ralph
and https://github.com/thebigjc/portableralph
please go throuhg our adapter code and check out whats going on, for some reason their ralph loops aren't visible on traces tui
Root Cause
history.jsonl-centric for ralph/portableralph usage (claude --print, often with --output-format stream-json).isAvailable() required history.jsonl, so sessions written under projects-only storage were treated as “adapter unavailable” (cli/src/adapters/claude-code/v1.ts:116).getTraces() returned history-backed traces first and did not surface project-only sessions when history existed but was stale (cli/src/adapters/claude-code/v1.ts:124).getTraceIndexBatch() cursor invalidation only watched history mtime/size, so project-side changes could be skipped forever (cli/src/adapters/claude-code/v1.ts:186).Fix Implemented
cli/src/adapters/claude-code/v1.ts:116).cli/src/adapters/claude-code/v1.ts:124, cli/src/adapters/claude-code/v1.ts:520).projectsMtimeMs, projectDirCount) so non-history updates trigger re-index (cli/src/adapters/claude-code/v1.ts:65, cli/src/adapters/claude-code/v1.ts:659).cli/test/core/adapters.test.ts:1150)cli/test/core/adapters.test.ts:1407).Validation
bun test test/core/adapters.test.ts in cli/ → passing (116 pass).bun test test/core/adapters.test.ts -t "claude-code:" → passing (12 pass).If you want, I can also add a tiny debug/status surfacing in traces status to explicitly show “history stale, using project fallback” so these cases are easier to diagnose in production.
also btw Session and Memory Storage
The Ralph loop is designed to "forget on purpose" to avoid context bloat. Instead of relying on a long-running internal session, it externalizes state to the filesystem:
Local Project Files: Progress is stored in your project directory using a prd.json (task list) and progress.txt (append-only log of learnings).
Git History: The loop typically makes a Git commit after every successful task, using the commit history as the permanent "memory" of the project's evolution.
CLI Session Cache: The underlying Claude Code CLI may store session IDs and local caches in your home directory (e.g., ~/.claude/tasks/) for up to 30 days to enable manual session resumption.
Docker Sandboxes: If running via Docker Desktop, state and credentials are often isolated within Docker volumes associated with that specific sandbox instance.
Would you like the Bash script template used to set up a manual Ralph loop on your local machine?
also:
yeah, I think what we're seeing is that if you invoke claude from the cli with -p it doesn't keep the ~/.claude/tasks dir. I don't know if opencode and codex would be the same / different.
also look at this log from his computer /Users/tarunsachdeva/Downloads/claude.txt