Skip to content

docs: add architecture record for codex-plugin-multi#29

Merged
seungpyoson merged 1 commit into
mainfrom
docs/codex-multi-architecture-record
Apr 30, 2026
Merged

docs: add architecture record for codex-plugin-multi#29
seungpyoson merged 1 commit into
mainfrom
docs/codex-multi-architecture-record

Conversation

@seungpyoson
Copy link
Copy Markdown
Owner

Summary

Adds docs/architecture-record.md — a 72-line record of the load-bearing architectural decisions made during early development of this repo, so future contributors can understand why the implementation differs from a simple upstream port of openai/codex-plugin-cc.

Why now

The doc was written during fix/022-followups development (PR #23) but never committed before that branch merged. Landing it as a standalone docs PR rather than rolling it into a feature PR keeps it reviewable on its own terms.

Topics covered

  • Containment vs. scope as orthogonal dimensions — the most important architectural choice, fixing the earlier design gap where "isolated" conflated where the model writes with what the model sees
  • ModeProfile as the single source of mode defaults — model tier, permission mode, disallowed tools, containment, scope, dispose default, context-stripping, add-dir behavior all live in one place, preventing cross-mode drift
  • One JobRecord shape — foreground output, background result files, status, result, and the result-handling docs all use the same schema
  • Distinct identity typesjob_id (minted by the companion), target session IDs (read from CLI output), resume chains (target session continuity), and PID ownership (for safe cancellation) are kept separate
  • Shared-library checks need behavior tests, not only byte identity — two copies can be equally broken
  • Upstream relationship to openai/codex-plugin-cc — what we keep, what we deliberately differ on

Test plan

  • Doc-only change; no code touched
  • Renders correctly in GitHub markdown preview
  • No links to non-existent files

Relations

Related to: #23 (the merged PR during which this doc was drafted)

Captures the load-bearing architectural decisions made during the early development of this repo so future contributors can understand why the implementation differs from a simple upstream port of openai/codex-plugin-cc.

Topics covered:
- Containment vs. scope as orthogonal dimensions (the most important architectural choice)
- ModeProfile as the single source of mode defaults (model tier, permission mode, disallowed tools, containment, scope, dispose, context-stripping, add-dir)
- One JobRecord shape across foreground/background/status/result paths
- Distinct identity types (job_id vs target session IDs vs resume chains vs PID ownership)
- Shared-library checks need behavior tests, not only byte identity
- Upstream relationship to openai/codex-plugin-cc

Doc was written during fix/022-followups development but never committed before PR #23 merged. This commit lands it on main as a standalone docs addition.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new architecture record for the project, outlining key design principles such as the separation of containment and scope, the centralized management of mode defaults via ModeProfile, and the use of distinct identity types. The review feedback suggests including the missing schema_allowed field in the ModeProfile documentation and providing a rationale for the current approach to shared libraries, which involves maintaining multiple copies of logic instead of extracting them into a single shared library.


Every mode-correlated setting lives in the `ModeProfile` table: model tier,
permission mode, disallowed tools, containment, scope, dispose default,
context-stripping, and add-dir behavior. Dispatcher libraries receive a profile
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The list of mode-correlated settings is missing schema_allowed, which is a functional field defined in the ModeProfile implementation (see plugins/claude/scripts/lib/mode-profiles.mjs). Including it ensures the architecture record remains an exhaustive reference for the "single source of mode defaults."

Suggested change
context-stripping, and add-dir behavior. Dispatcher libraries receive a profile
context-stripping, add-dir behavior, and schema-allowed status. Dispatcher libraries receive a profile

Comment on lines +61 to +63
Claude and Gemini share many library copies. Byte identity is useful, but it is
not sufficient: two copies can be equally broken. Shared-library checks also
require clean imports, production consumers, and behavior tests.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The document notes that Claude and Gemini "share many library copies." This implementation pattern (maintaining multiple copies of the same logic) conflicts with the organization's general rule to extract shared logic into a common library. The architecture record should clarify the rationale for this duplication (e.g., for plugin isolation) or reflect a plan to align with the shared library rule.

References
  1. When the same logic is implemented in multiple files, extract it into a shared library and add a test to ensure the files remain synchronized.

@seungpyoson seungpyoson marked this pull request as ready for review April 30, 2026 12:20
@seungpyoson seungpyoson merged commit a557300 into main Apr 30, 2026
9 checks passed
@seungpyoson seungpyoson deleted the docs/codex-multi-architecture-record branch April 30, 2026 12:28
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