Skip to content

Establish Bridge Protocol for MATLAB-Python parity#22

Merged
stevevanhooser merged 5 commits into
mainfrom
claude/update-dev-docs-pCV94
Mar 12, 2026
Merged

Establish Bridge Protocol for MATLAB-Python parity#22
stevevanhooser merged 5 commits into
mainfrom
claude/update-dev-docs-pCV94

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

This PR establishes a formal "Bridge Protocol" to maintain strict 1:1 functional and semantic parity between the MATLAB source codebase and the Python port. The changes replace a single monolithic porting guide with a modular, contract-driven system centered on YAML bridge files.

Key Changes

  • Removed: PYTHON_PORTING_GUIDE.md — The original monolithic guide that mixed high-level philosophy with low-level implementation details.

  • Added: Three New Developer Documentation Files

    • docs/developer_notes/PYTHON_PORTING_GUIDE.md — Condensed technical workflow guide focused on Pydantic validation, naming rules, and linting requirements.
    • docs/developer_notes/ndi_xlang_principles.md — Universal cross-language principles (0-vs-1 indexing, Semantic Parity for scientific counting, NumPy usage, error handling).
    • docs/developer_notes/ndi_matlab_python_bridge.yaml — YAML specification template defining how bridge files should be structured and maintained.
  • Added: Agent Instructions

    • AGENTS.md — Role definition and mandatory knowledge base for AI developers, emphasizing the Bridge Protocol and active maintenance of interface contracts.
    • .cursorrules — Cursor IDE configuration to enforce the Bridge Protocol during development.

Notable Implementation Details

  1. Bridge Protocol: Each sub-package now contains an ndi_matlab_python_bridge.yaml file that serves as the binding contract for function names, arguments, and return types. This is the "Primary Contract" that agents must consult and maintain.

  2. Active Maintenance Requirement: Agents are explicitly instructed to update bridge files when porting new functions and notify users of interface changes with: "INTERFACE UPDATE: I have modified the bridge contract for [Function Name]."

  3. Semantic Parity Rule: Distinguishes between Computer Science Indexing (0-based for internal Python data structures) and Scientific Counting (1-based for user-facing concepts like Epochs and Channels) to prevent off-by-one errors across platforms.

  4. Strict Naming Policy: Reinforces that MATLAB names are the source of truth and must not be "Pythonized" (e.g., ListAllDocuments stays as-is, not list_all_documents).

  5. Mandatory Knowledge Base: Agents must read files in a specific order: AGENTS.mdPYTHON_PORTING_GUIDE.mdndi_xlang_principles.md → local bridge file.

https://claude.ai/code/session_01J2cPiPbCXUV9ofBwjtASd1

claude added 5 commits March 12, 2026 12:50
Relocate PYTHON_PORTING_GUIDE.md from repo root to
docs/developer_notes/ and replace with updated development
documentation covering the lead-follow architecture, bridge
protocol, naming conventions, Pydantic validation, and code
style requirements.

https://claude.ai/code/session_01J2cPiPbCXUV9ofBwjtASd1
Add ndi_xlang_principles.md covering indexing/counting parity,
data containers, multiple returns, booleans, string handling,
error philosophy, and AI agent instructions for maintaining
consistency between MATLAB and Python implementations.

https://claude.ai/code/session_01J2cPiPbCXUV9ofBwjtASd1
Add ndi_matlab_python_bridge.yaml documenting the YAML spec for
MATLAB-to-Python bridge files: standard header, active maintenance
instructions, class/function structure examples, and field rules.

https://claude.ai/code/session_01J2cPiPbCXUV9ofBwjtASd1
Define the role, mandatory knowledge base, bridge file protocol,
technical constraints, and directory mapping for AI agents working
on the NDI MATLAB-to-Python port.

https://claude.ai/code/session_01J2cPiPbCXUV9ofBwjtASd1
Configure Cursor to follow NDI porting guidelines, strict naming
policy, and bridge file active maintenance protocol.

https://claude.ai/code/session_01J2cPiPbCXUV9ofBwjtASd1
@stevevanhooser stevevanhooser merged commit 1fa1845 into main Mar 12, 2026
4 checks passed
@stevevanhooser stevevanhooser deleted the claude/update-dev-docs-pCV94 branch March 12, 2026 12:59
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.

2 participants