{
  "id": 18771435,
  "title": "osFoundry 如何在磁碟上找到你的 Claude Code 和 Codex 工作階段，用 Python 重做一遍",
  "url": "https://urgent.news/2026/11/07/osfoundry-claude-code-codex-python",
  "topic": "ai",
  "section": "AI",
  "published": "2026-11-07T19:05:12.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bbt-zh/osfoundry-ru-he-zai-ci-die-shang-zhao-dao-ni-de-claude-code-he-codex-gong-zuo-jie-duan-yong-python-zhong-zuo-bian-578a"
  },
  "original_language": "en",
  "account": "Claude Code and Codex sessions are stored as JSONL files on disk, with filenames matching the session ID. These files are located within a folder named after the workspace directory. The folder name is a sanitized version of the absolute path, replacing all non-alphanumeric characters with hyphens. The session files contain a list of records, with each line representing a record containing various attributes such as 'type', 'sessionId', 'cwd', 'gitBranch', 'timestamp', and 'version'. The records also include 'user' and 'assistant' entries, which contain important information like the model used, effort, git branch, and message content. The titles are derived from the 'custom-title' record or, in some cases, from the 'ai-title' record. The JSONL files can be quite large, with the median file size being around 168 MB and the maximum size reaching up to 2.07 GB. To efficiently process these files, osFoundry reads only the first 80 lines and the last 512 KiB of each file. The script written in Python reads these sessions and extracts the required fields, including the App name, session ID, workspace directory, git branch, and title. The script avoids parsing the entire file and instead focuses on the relevant sections, optimizing the processing time.",
  "summary": "~/.claude/projects/-Users-alex-code-shop-api/c5e1a7b2-9d40-4f3e-8b16-2a7c0e9d4f58.jsonl ~/.claude/projects/-Users-alex-code-shop-api/c5e1a7b2-9d40-4f3e-8b16-2a7c0e9d4f58/subagents/agent-<id>.jsonl ~/.codex/state_5.sqlite -> table threads (id, rollout_path, cwd, git_branch, title, …) ~/.codex/sessions/2026/11/04/rollout-2026-11-04T10-00-00-<thread id>.jsonl $ claude --resume…",
  "key_points": [
    "Claude Code and Codex sessions stored as JSONL files on disk",
    "Session files contain attributes like type, sessionId, cwd, gitBranch, timestamp, version",
    "Python script efficiently extracts required fields from sessions without parsing entire files"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}