feature: let `session.archive` set where it writes, so a second Cortex can keep its own sessions
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Read the session.archive configuration and cost_ledger.dir handling referenced in the issue, along with laptop-service.md; inspect how the archive chooses its directory and applies the local-install rule. Trace startup logging and the DELETE /v1/sessions loopback restriction. Done means an absolute dir overrides the default locally and enables archiving off a local install only when explicitly set with enabled: true, while existing retention and safety behavior remains intact.
索引モデルが issue の本文から書いたものです。
説明
Problem
The session archive always writes to ~/.cortex/sessions, and runs only when Cortex is started from a config inside ~/.cortex. There is no setting for the location.
That rules out keeping sessions on disk for any Cortex other than the one installed in ~/.cortex, for example:
- a second, side-by-side Cortex for development or experiments, run from a scratch directory next to your everyday one (the shape
docs/evolve-plugin-e2e.mduses on ports477xx); - a demo or walkthrough that should keep everything it produces in one directory you can inspect and then delete.
Today such a Cortex keeps sessions in memory only. Restart it and every session is gone, including from agentop observe and the session API.
The only workaround I found is to start the second Cortex with HOME pointed at a scratch directory that contains its own .cortex/, holding a copy of the config and of the CA:
mkdir -p "$WALK/cortex-home/.cortex"
cp -R ~/.cortex/ca "$WALK/cortex-home/.cortex/ca" # copies the CA private key
sed -e 's/127.0.0.1:4760\([0-9]\)/127.0.0.1:4770\1/g' \
-e "s|$HOME/.cortex/ca|$WALK/cortex-home/.cortex/ca|" \
~/.cortex/config.yaml > "$WALK/cortex-home/.cortex/config.yaml"
HOME="$WALK/cortex-home" cortex --config "$WALK/cortex-home/.cortex/config.yaml"
It works: the archive is enabled, sessions survive a restart, and /v1/sessions?archived=true and agentop list them. But it has costs:
- The CA's private key is duplicated into a scratch directory.
HOMEmoves more than the archive: the cost ledger, the plugin store and the price list move too, and anything else keyed on a local install changes with it (memory limit, bundled pricing).- It's hard to explain in a walkthrough, and easy to get subtly wrong.
Proposal
Add a dir to session.archive, mirroring cost_ledger.dir:
session:
archive:
enabled: true
dir: /absolute/path/to/sessions # default ~/.cortex/sessions; a relative path is refused
Behaviour:
dirmust be absolute, refused otherwise with the same reasoning ascost_ledger.dir(a relative path depends on the working directory, not the config).- Off a local install, the archive runs only when both
enabled: trueanddirare set. Withoutdir, the current rule stands, so a cluster still can't turn the archive on just by mounting a volume over~/.cortex. - On a local install,
diroverrides the default location; everything else is unchanged. - Retention,
max_bytesand clearing behave as today.DELETE /v1/sessionskeeps its loopback-only rule, so a non-loopback Cortex with an explicitdirstill can't be cleared over the API, and the startup line keeps saying so. - The startup log line already names the directory, so an operator can see where content is written.
Why this keeps the current safety reasoning
The existing docs (config.SessionArchiveConfig, laptop-service.md) explain why there is no dir: the archive stores raw prompts, completions and tool results, and on a cluster that needs a decision of its own rather than "a mounted path". This proposal keeps that: off a local install, nothing turns on unless someone writes both enabled: true and an explicit absolute dir, which is a decision rather than an accident of a mount. On a laptop, it only lets a user choose where their own history goes.
Alternatives considered
- Keep the
HOMEworkaround. Works, but duplicates the CA key and moves unrelated state; see above. - A
--session-archive-dirflag. Same effect, but the archive's other settings are config, and a flag is invisible in the config a reader inspects. - Save sessions on demand through the API (
GET /v1/sessions/{id}to a file). Fine for one session, but loses restart survival, agentop's archived list and retention.
Open questions
- Should
dirbe allowed to point inside another Cortex's~/.cortex, or refused to avoid two processes sharing one archive? - Should the plugin store and cost ledger get the same treatment, so a side-by-side Cortex can be fully self-contained without touching
HOME?
Context
Related: #1645 (running Cortex without touching the everyday install).
Found while writing a walkthrough that runs a dev Cortex with the evolve plugin next to an everyday install, and wanting its sessions to survive a restart for later inspection. Tested on Cortex evolve-plugin (ab08dda3, on main 8b0facd5), macOS arm64.
- 主要言語
- Go
- スター
- 23
- フォーク
- 44
- 平均マージ
- 14時間 38分
- マージ済み PR(30日)
- 254
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rossoctl/cortex のほかの issue
-
feature: agentop observe — show a request and its response as one row対応中かも @huang195 が今日担当しました。 オープンenhancement ux
rossoctl/cortex#1681 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
feature: agentop observe — search user prompts and agent responses across a session's events対応中かも @huang195 が今日担当しました。 オープンenhancement ux
rossoctl/cortex#1680 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
feedback laptop
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
メンテナーはふだん 1 日以内に返信
-
chore: Remove the decline_responses_websockets translation after a deprecation release対応中かも @Alan-Cha が 4 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
rossoctl/cortex#1625 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
agentop configure codex/opencode can wait on itself when an agent runs it対応中かも @Alan-Cha が 10 日前に担当しました。 オープン
rossoctl/cortex#1530 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
rossoctl/cortex の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
router-for-me/CLIProxyAPI#7330 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug os:ios
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hajimehoshi/ebiten#4039 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 9 日以内に返信