Skip to content

feat(plugins): add queryable coding session profiles - #1125

Merged
phernandez merged 5 commits into
mainfrom
codex/coding-session-profile
Jul 21, 2026
Merged

feat(plugins): add queryable coding session profiles#1125
phernandez merged 5 commits into
mainfrom
codex/coding-session-profile

Conversation

@phernandez

@phernandez phernandez commented Jul 21, 2026

Copy link
Copy Markdown
Member

Why

General project work and coding work need different query contracts. A general checkpoint should stay lightweight, while a coding checkpoint must carry enough verified Git and pull-request identity to answer questions such as “which session covered this PR?” without parsing prose.

What Changed

  • Add a dedicated, shared coding_session schema with required repository, repo-root, working-directory, branch, and Git SHA fields.
  • Keep codex_session and Claude session as the general-profile schemas.
  • Make setup seed exactly the session schema relevant to the selected profile, plus decision and task schemas.
  • Make deliberate and automatic PreCompact checkpoints select coding_session for coding profiles in both Codex and Claude.
  • Filter coding-session recall by the user-confirmed repository, then merge lower-priority legacy/general sessions for continuity.
  • Change the default Codex checkpoint folder from codex-sessions to codex while preserving explicit captureFolder overrides.
  • Keep the Claude and Codex copies of coding-session.md byte-identical and enforce that contract with a package test.

Implementation Details

.codex/basic-memory.json and Claude's basicMemory settings persist sessionProfile explicitly. Coding setup requires a user-confirmed stable repository identifier; automatic checkpoints resolve the remaining required fields through bounded, read-only Git commands. Missing required Git evidence stops the checkpoint before a schema-invalid note is written, while the outer hook boundary still fails open for the host session.

Pull-request context comes from a bounded, read-only gh pr view call. The complete typed PR field set is written when a PR exists, with state normalized to the schema's lowercase enum; all PR fields are omitted when no PR exists.

SessionStart uses metadata_filters={"repository": "owner/name"} for coding_session recall. It never performs an unscoped coding-session query, so a Basic Memory project shared by multiple repositories cannot promote another checkout's branch or PR as the current cursor.

Testing

  • uv run pytest tests/test_codex_plugin_package.py tests/cli/test_coding_session_context.py tests/cli/test_hook_command.py -q — 113 passed
  • just fast-check — passed; only existing Python 3.14 asyncio deprecation warnings
  • just package-check — passed
    • 257 package tests passed; 12 opt-in integration tests skipped
    • 226 OpenClaw tests passed
    • Claude Code, Codex, shared-skills, and Hermes validators passed
  • just package-check-claude-code — passed
  • just package-check-codex — passed
  • Verified the Claude and Codex coding schema files are byte-identical

Risks / Follow-up

The bundled Codex PEP 723 hook wrappers cannot safely pin themselves to this PR’s source SHA because the repository squash-merges. Per the agreed sequence, this PR lands the core behavior first; an immediate follow-up will update both Codex hook dependency refs to the durable #1125 merge SHA and run the package gates again. Claude’s wrappers intentionally resolve the released basic-memory package, so that automatic path activates with the next package release (or a development BM_BIN override).

@phernandez
phernandez marked this pull request as ready for review July 21, 2026 00:23
@phernandez
phernandez force-pushed the codex/coding-session-profile branch from ed2c7d4 to af902d1 Compare July 21, 2026 00:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed2c7d4a10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/hook.py Outdated
@phernandez
phernandez marked this pull request as draft July 21, 2026 00:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af902d1ebd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/hook.py Outdated
@phernandez
phernandez force-pushed the codex/coding-session-profile branch from af902d1 to 31f0cd2 Compare July 21, 2026 00:34
Base automatically changed from feat/claude-code-bm-writing to main July 21, 2026 00:51
@phernandez
phernandez marked this pull request as ready for review July 21, 2026 00:52
Signed-off-by: phernandez <paul@basicmachines.co>
This reverts commit 11e2cd5.

Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31f0cd2f4e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/hook.py Outdated
Comment thread plugins/claude-code/skills/bm-setup/SKILL.md Outdated
@phernandez
phernandez force-pushed the codex/coding-session-profile branch from 31f0cd2 to 9c1739b Compare July 21, 2026 01:00
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the codex/coding-session-profile branch from 9c1739b to 435d16c Compare July 21, 2026 01:02
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez phernandez changed the title feat(plugins): add queryable Codex coding sessions feat(plugins): add queryable coding session profiles Jul 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 435d16c3a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/skills/bm-setup/SKILL.md
Comment thread src/basic_memory/cli/commands/hook.py Outdated
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the codex/coding-session-profile branch from 25cdb00 to 88fb8e4 Compare July 21, 2026 01:14
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 88fb8e4679

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88fb8e4679

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/skills/bm-checkpoint/SKILL.md
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: f551808571

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez
phernandez merged commit d8e9ab8 into main Jul 21, 2026
29 of 30 checks passed
@phernandez
phernandez deleted the codex/coding-session-profile branch July 21, 2026 01:40
phernandez added a commit that referenced this pull request Jul 21, 2026
Close the remaining skill-parity gap with the Codex plugin (#1125):

- skills/bm-decide — deliberate decision capture with rationale,
  alternatives, consequences, and affected work, written to the bm-writing
  standard. Works whether or not the output style's inline capture reflex
  is enabled; bm-remember and the output style now point to it.
- skills/bm-orient — deliberate mid-session orientation: active tasks,
  open decisions, and recent checkpoints, presented as an evidence-backed
  summary with permalinks. Coding-session recall stays repository-scoped;
  an unscoped coding-session query is forbidden, matching the Codex
  contract.

validate_claude_plugin.py requires both skills and pins their contracts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A2bgrGfWiL4izcjj66u9R8
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f551808571

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/README.md
Comment on lines 14 to +16
- **Checkpoint work.** The `bm-checkpoint` skill and `PreCompact` hook write
`type: codex_session` notes with the current work cursor.
general `codex_session` notes or schema-backed `coding_session` notes with
structured repository and pull-request context.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pin Codex hook shims before advertising coding checkpoints

For Marketplace plugin users, this claim is not true yet: hooks/hooks.json runs hooks/pre_compact.py, whose PEP 723 dependency is still pinned to basic-memory@6e9f2fc...; that ref's hook implementation has no coding_session path and still defaults Codex to codex-sessions. Users who set sessionProfile: "coding" will therefore keep getting legacy codex_session PreCompact notes and non-repository-scoped SessionStart recall until the shim dependency is updated and validated against this merge/release ref.

Useful? React with 👍 / 👎.

Comment on lines +74 to +76
When the current branch has a pull request, also add the typed optional fields
`pull_request_number`, `pull_request_title`, `pull_request_url`,
`pull_request_state`, `pull_request_base`, and `pull_request_head`. Resolve the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Lowercase PR state in Codex checkpoints

When a Codex deliberate checkpoint follows this section and copies gh pr view --json state, the value is the GitHub enum (OPEN/CLOSED/MERGED) while plugins/codex/schemas/coding-session.md only accepts lowercase [open, closed, merged] and the automatic hook lowercases it. Without the same lowercase instruction, the note gets a schema warning and exact queries such as pull_request_state="open" miss it; Claude's matching skill already calls this out.

Useful? React with 👍 / 👎.

phernandez added a commit that referenced this pull request Jul 21, 2026
Git emits repo_root with forward slashes on every platform, while the
hook event cwd arrives in native form — on Windows that is C:/Users vs
C:\Users, so the coding checkpoint's repo_root == cwd identity broke and
tests/cli/test_coding_session_context.py failed on the Windows matrix.
Main never saw it: the #1125 push run was cancelled by the follow-up
merge and the next run skipped the Python matrix (plugins-only change).

Store both fields in POSIX form so coding-session path identity is
comparable and queryable cross-platform.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A2bgrGfWiL4izcjj66u9R8
Signed-off-by: phernandez <paul@basicmachines.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant