Repository navigation
One data directory and one credentials directory for every package - #27
Merged
Merged
Conversation
The inline pgrep guard ran inside the ssh command, whose own command line contains the sync_loop path, so it always matched and the loop never started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP
data/ and credentials/ at the repository root are gitignored symlinks to directories outside the checkout, so every worktree shares one set of output and keys; in the main checkout they may also be real directories. scripts/setup_worktree.sh creates the links (a linked worktree points at whatever the main checkout has), and .githooks/post-checkout runs it for every new worktree once `git config core.hooksPath .githooks` is set (the README notes that this replaces .git/hooks). fbsim_core.local finds the repository root (from its own file in an editable install, else from the working directory; with neither, it warns and uses the working directory), gives data_dir(package) = <repo>/data/<package>, and load_env() reads credentials/.env, one sourceable file with every variable any package needs; exported variables win. FBSIM_TEST_DATA_ROOT and FBSIM_TEST_ENV_FILE redirect both, for tests only (FBSIM_DATA_ROOT is deliberately not used: in forecastbench-sim-paper it names the private data archive). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP
The data root is <repo>/data whatever the working directory (it was ./data); a config's data_dir still selects one folder in it, and the example configs keep their own. credentials/.env is read only when a runner needs the engine or provider keys (engine_app_path, ensure_api_keys), never at import or for --help. The tests keep the checkout's credentials out, subprocesses included, and point the data root at a temporary directory with FBSIM_TEST_DATA_ROOT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP
scale_eval.py writes its response cache, scale_results.json and conditional_brier_gap.png to data/pandemic/ and loads credentials/.env before calling models. The three result files (with null_conditional_results.json, which no code writes) leave git; copies are in data/pandemic/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP
The logging root (logs and game recordings) is data/freeciv/logs, from logging_config.logging_dir, the single source the engine and run_world.py share; game scores and their plots go to data/freeciv too. The scripts' paths relative to the working directory (data/games, data/questions, data/conditional, data/results, data/evaluations, logs/recordings) are now absolute under data/freeciv, quoted in the shell scripts. Scripts load credentials/.env instead of worlds/freeciv/.env and still fetch provider keys from GCP Secret Manager with its GOOGLE_CLOUD_PROJECT; the agentic shell scripts' dead src.civrealm import is fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP
fleet/paths.sh, sourced by every fleet script, puts the run state (pod ledger, queues, anchors, logs) in data/freeciv/fbsim_v3/fleet_state and the ssh keys in credentials/freeciv/; rp.sh reads RUNPOD_API_KEY from credentials/.env when it is not exported. Paths are quoted and pods are reached through podsh (the key is quoted inside rsync -e strings), so a checkout path with spaces works. Pods record games under data/freeciv/logs, as in the checkout. The run/ elicitation scripts load credentials/.env and drop --env-file, so they now run with uv run (they import fbsim_core); make_queue.py defaults to the fleet state's queue; the bundle excludes .env files. PROVENANCE.json records these adaptations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP
fdrocha
marked this pull request as ready for review
October 28, 2026 13:27
elsehow
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As I am preparing to do more runs of world generation and prompting I ran into inconsistencies about how the different world packages handle credentials and output data. I decided to re-organize it a bit before doing any of the runs and this PR does that.
Details from Claude:
Every package now writes its output to
data/<package>/and reads its keys from a singlecredentials/.env, both at the repository root and both normally symlinks to directories outside the checkout, so concurrent worktrees share one set of data and keys. New worktrees get the links automatically through a committed post-checkout hook. Also a FreeCiv v3 fleet bug fix found in the one-player pilot (400 replays on RunPod).The commits are split by package, so each reviewer can read just theirs. The cross-package base is the second commit.
450dd944FreeCiv v3 fleet: start the worker's archive sync through start_sync.sh. The inlinepgrepguard ran inside the ssh command, whose own command line contains thesync_looppath, so it always matched and the sync loop never started (found in the pilot, where it had to be started by hand).92e8d7f2One data directory and one credentials directory, outside the checkout.fbsim_core.local(repo root,data_dir(package),load_env());scripts/setup_worktree.shand.githooks/post-checkout; root.gitignore, README section "Local data and credentials",CLAUDE.md.FBSIM_TEST_DATA_ROOTandFBSIM_TEST_ENV_FILEare test-only overrides.FBSIM_DATA_ROOTis deliberately not used, because in forecastbench-sim-paper it names the private data archive.a2dd75d4Micropolis: data root and keys from fbsim_core.local. The data root is<repo>/datawhatever the working directory (it was./data).credentials/.envis read only when a runner needs the engine or keys, never at import or for--help. The tests keep the checkout's credentials out, subprocesses included.d4d44c8ePandemic: cache and results under data/pandemic.scale_results.json,conditional_brier_gap.pngandnull_conditional_results.jsonleave git.74cda6d9FreeCiv: output under data/freeciv, keys from credentials/.env. The engine's logging root (logs, recordings) moves todata/freeciv/logsthroughlogging_config.logging_dir; game scores move too. About 140 paths inscripts/that were relative to the working directory become absolute underdata/freeciv(mechanical). The scripts still fetch provider keys from GCP Secret Manager; onlyGOOGLE_CLOUD_PROJECTnow comes fromcredentials/.env. The agentic shell scripts' deadsrc.civrealmimport is fixed.cf9aed5cFreeCiv v3: fleet state and keys outside the checkout.fleet/paths.shputs the run state indata/freeciv/fbsim_v3/fleet_stateand the ssh keys incredentials/freeciv/. Paths are quoted and pods are reached throughpodsh, so checkout paths with spaces work. Pods record games underdata/freeciv/logs.--env-fileis removed from therun/elicitation scripts.PROVENANCE.jsonrecords the adaptations.Heads-up for coauthors
After this merges, once per clone:
Create
credentials/.envat the repository root (gitignored), with every variable from your oldworlds/*/.envfiles in one file:ANTHROPIC_API_KEY,OPENROUTER_API_KEY,GOOGLE_CLOUD_PROJECT(FreeCiv still fetches its provider keys from GCP Secret Manager with it),RUNPOD_API_KEY(fleet only),MICROPOLIS_CORE_PATH, andDEEPINFRA_API_KEY(Pandemicscale_eval.py --eval). Variables exported in the shell still win.Move existing output:
worlds/freeciv/logs/→data/freeciv/logs/;games/,questions/,conditional/,results/andevaluations/(from the rootdata/orworlds/freeciv/data/) →data/freeciv/;worlds/pandemic/.response_cache.json→data/pandemic/response_cache.json.data/micropolis*stays where it is.Optional:
git config core.hooksPath .githooks, so new worktrees get the links automatically. It replaces.git/hooks; if you have hooks there, runscripts/setup_worktree.shby hand instead.data/andcredentials/can stay real directories in your main checkout; the symlinks are only needed to keep them outside it.Testing
fbsim_core.localfinding the checkout from the working directory. The two benchmark tests that assert a non-editable install fail in the workspace venv, as onmain.py_compileon all 60 changed Python files;bash -non all 28 changed shell scripts; ruffF821/F401on the changed Python shows no new findings compared withmain.rp.sh listauthenticates with the key fromcredentials/.env;rp.sh ledger,status.sh,launch_pending.shandfinish_all.sh --dry-runwork against the moved state.-eandpodshchecked to receive a spaced key path as one argument..envfiles or symlinks.git worktree addgot both links from the post-checkout hook.build_paper.shroute (editablefbsim-core/fbsim-benchmark) was run againstmainand against this branch, into scratch copies of the manuscript. The outputs are byte-identical. The paper's default route uses the pinned9e016b76, which this branch cannot affect./workspace/civbench/data/freeciv/logs) and the fleet scripts' changes will first run with the next anchor pod. The earlier fleet commits ran the 400-replay pilot.🤖 Generated with Claude Code
https://claude.ai/code/session_01Tze4Twn5EYv7cQxwxUcBpP