This policy defines what belongs in source control and what belongs in local runtime storage. It does not change current runtime paths or move any files.
Source control should contain:
- Application source code.
- Tests.
- Documentation.
- CI configuration.
- Placeholder-only examples such as
.env.example. - Dependency manifests.
Source control should not contain:
- Real secrets.
- Local environment files.
- SQLite databases.
- Logs.
- PID files.
- Runtime JSON/JSONL state.
- Local backups and archives.
- Virtual environments and cache folders.
Runtime files are produced by local operation. They may contain account state, trade history, dashboard state, AI output, operational logs, or local secrets. They must stay in local runtime storage, private backups, or deployment-managed volumes.
SQLite files are local runtime artifacts:
*.sqlite3*.sqlite3-wal*.sqlite3-shm
The default local database is currently tradebot.sqlite3. WAL and SHM files
may be created by SQLite while the database is active. These files should not be
committed or shared in public archives.
Logs are local runtime artifacts:
*.log*.nohup.out
Logs may include operational decisions, endpoint errors, account context, runtime paths, or other sensitive details. Keep logs private unless they have been reviewed and redacted.
PID files are local process markers:
*.pid
PID files are machine-specific and should never be committed.
JSON and JSONL runtime mirrors are local artifacts. Current examples include:
state.jsonruntime_state.jsontrades.jsonlai_decisions.jsonldashboard_history.jsondashboard_intelligence.json- generated local dashboard intelligence cacheengine_status.jsoncumulative.jsonai_signal.jsonai_memory.json
Legacy local artifacts from removed workflows also remain ignored:
advisor.log- legacy advisor/flexy workflow loggrid_honest_replay*.json- legacy generated honest replay outputs; ignored to avoid surfacing old local files after replay script removalstate_trend.json- legacy trend engine mirrorengine_status_trend.json- legacy trend engine mirrorcumulative_trend.json- legacy trend engine mirrortrades_trend.jsonl- legacy trend engine mirrorengine_trend.log- legacy trend engine log
Runtime mirrors and retained legacy artifacts may be useful for compatibility, inspection, recovery, or migration work, but they are not source files.
Local environment files are private configuration:
.env.env.*
.env.example is the tracked template and must contain placeholders only. Do
not commit real Binance keys, dashboard tokens, local service URLs, account
identifiers, or production configuration values.
The repository currently keeps some runtime paths in the repo root for compatibility. A future behavior-preserving migration can separate runtime data from source more clearly:
var/
|-- runtime/
| |-- tradebot.sqlite3
| |-- state.json
| |-- runtime_state.json
| `-- dashboard_history.json
|-- logs/
| |-- engine.log
| |-- dashboard.nohup.out
| `-- ai_sidecar.nohup.out
`-- archive/
|-- accounting_archive_YYYY-MM-DD/
`-- manual-backups/
Recommended future directories:
var/runtime/for active SQLite, JSON, and JSONL runtime state.var/logs/for logs and detached process output.var/archive/for private local backups and accounting archives.
Do not move runtime paths until code, wrappers, tests, deployment scripts, and operator workflows are ready.
Before upgrades, migrations, cleanup, or recovery work:
- Stop local services when possible.
- Copy SQLite files, including WAL and SHM sidecars when present.
- Copy JSON/JSONL mirrors if they are needed for recovery or comparison.
- Copy logs only when needed for troubleshooting or audit.
- Store backups outside Git in a private local or deployment-managed location.
- Do not include secrets or runtime artifacts in public ZIP files.
- Record the branch, commit hash, timestamp, and reason for the backup without recording secret values.
To restore local runtime state safely:
- Stop local services.
- Back up the current runtime files before replacing them.
- Restore the intended SQLite database and matching WAL/SHM files if needed.
- Restore JSON/JSONL mirrors only if they are part of the intended recovery.
- Start services.
- Check status and dashboard health.
- Review logs locally without printing secret values into issues, commits, or support messages.
Inspect tracked files:
git ls-filesSearch tracked files for runtime-looking paths:
git ls-files | grep -E '(^\\.env|\\.sqlite3|\\.sqlite3-wal|\\.sqlite3-shm|\\.log$|\\.pid$|\\.nohup\\.out$|\\.jsonl$)'If a local runtime file was accidentally staged, unstage it:
git restore --staged path/to/runtime-fileIf a runtime file was accidentally committed and should stop being tracked in a
future cleanup commit, use git rm --cached examples like these, but do not run
them without confirming the file is truly a runtime artifact:
git rm --cached tradebot.sqlite3
git rm --cached engine.log
git rm --cached trades.jsonl
git rm --cached .envAfter removing a tracked runtime artifact from Git, rotate any exposed secrets and keep the local file in private runtime storage.