Skip to content

task: consolidate existing MindIE adapters under Apps #452

Open

Description

@Dong1017

Goal

Relocate the MindIE-specific adapter already in this repository entirely into src/inferrsi/apps/mindie/ (project.py, context.py, mcp.py, read_worker.py). This bounded migration does not take over the broader MindIE Agent integration and real-task qualification tracked by #374, and does not include an internal refactor of existing subpackages. Related: #371, #408 and #412.

PR checklist

  • M1 — Consolidate the existing MindIE adapter in Apps and retire the four root paths. Candidate internal files are project.py, context.py, mcp.py and read_worker.py. Add worker_process.py only if the subprocess launch/limit handling is shared by more than one module inside apps/mindie; do not introduce a one-user abstraction. Keep provider-specific pure projection inside the adapter as pure functions. Keep read_worker.py a standalone file whose top-level imports are stdlib-only: it still runs under the approved MindIE interpreter and imports mindie_knowledge inside read(), so do not describe the worker as stdlib-only overall. It must not gain relative or package imports, and apps/mindie/__init__.py must stay import-free. Repoint mindie_mcp.py:7's from . import __version__ to from ... import __version__ (or an absolute import) when the module moves; do not re-export __version__ from apps/mindie/__init__.py.
  • In that same PR update the canonical CLI, worker/package lookup, active consumers, docs and tests; delete root mindie_project.py, mindie_context.py, mindie_mcp.py and _mindie_read_worker.py, and shrink the C1 exact-root inventory guard by these four files in the same PR.

Dependencies and boundaries

Integrate after the canonical CLI migration A1 in #408. All MindIE-specific code, including the worker, stays in apps/mindie/: do not add MindIE-specific Harness, Knowledge or infra modules, and do not create an extensions/ package or scatter MindIE-specific files into the core modules. Apps calls its worker and records original bytes, digests and receipts through applicable existing generic factual-storage interfaces. Verify interface suitability during implementation; do not invent a MindIE-specific core service. Harness must not depend on MindIE or infra.

Acceptance

  • Preserve grant storage and explicit opt-in; no implicit activation, counter changes or new MindIE capability.
  • Preserve the external-worker -I -B boundary, private working directory, 20-second/2-MiB limits and read-only SQLite behavior, including negative tests; add a negative test proving the worker still runs from an installed wheel with -I -B and no package-relative imports.
  • Preserve source bytes, digests, attribution and receipts. Pure projection has no I/O; do not silently substitute canonical JSON rules for the existing strict parser, and keep the existing strict-parser negative tests byte-for-byte.
  • Verify installed-wheel worker lookup outside the checkout, stdio behavior and worker import/isolation side effects, including an installed-wheel import of apps.mindie.mcp; do not introduce eager core imports through package initializers. Keep the accepted OBS layout decision: the historical six-key/no-retrieval path for readers providing neither observation nor provenance, and the existing extended path otherwise.
  • No new MindIE-specific code outside apps/mindie, no four-layer migration, no permanent old-root aliases, and no claims of broader task: 支持 MindIE Agent 对接(知识、执行与评测交接) #374 real-task qualification.

Delivery discipline

  • One implementation Claude session handles only the current PR in an isolated worktree. A second Claude session may only plan the next PR in a separate planning worktree; it must not edit source.
  • Move implementation, update all active consumers/docs/tests, and delete the corresponding old root modules in the same PR. Do not introduce permanent compatibility shells or module-registry aliases.
  • Preserve CLI command behavior, original evidence bytes, record/format contracts and isolation/security checks. Announce retired Python import/serialization module paths; historical frozen evidence remains pinned to its original commit or wheel, not rewritten.
  • Before each implementation or review handoff, refresh main and confirmed dependencies. A completed plan is not implementation or approval. No automatic merge.

Activity

  1. amy-why-3459 commented on Nov 15, 2026

    @amy-why-3459
    Collaborator

    Thanks, the boundary against #374 is clear. I checked current main (1373ef8e) and have a few notes for M1:

    1. Worker lookup and isolation. mindie_project.py:17 resolves the worker as Path(__file__).with_name("_mindie_read_worker.py") and launches it with [grant["python"], "-I", "-B", str(_WORKER), ...] (line 104). Because the worker runs by file path under -I, apps/mindie/read_worker.py must stay a standalone stdlib-only script. That holds today: it imports only json, sqlite3, sys, contextlib, importlib.metadata, etc. It must not gain relative or package imports during the move, and apps/mindie/__init__.py must not execute anything on the worker's behalf. A negative test asserting the worker still runs from an installed wheel outside the checkout (which the acceptance already lists) would catch a regression here.
    2. Consumer set is small. Outside the four modules themselves, the only consumers are src/inferrsi/cli.py and tests/test_mindie_{project,context,runtime}.py. Since this lands after task: A-entry — canonical Apps entrypoints and application composition #408 A1 moves cli.py to apps/cli, it would help to note that M1 rebases onto A1 and updates the apps/cli import, not the root one.
    3. Root inventory guard. task: consolidate shared contracts and packaged-resource access #451 C1 introduces an exact root-file inventory guard. M1 deletes four root files, so it should shrink that list in the same PR. Could the checklist mention this explicitly?
    4. worker_process.py. Since it is optional, could the issue say what decides it (for example, only if the subprocess launch/limit handling is shared by more than one module inside apps/mindie)? That avoids adding a one-user abstraction.
    5. Strict parser. The acceptance says not to swap the existing strict parser for canonical JSON rules. If that parser lives in mindie_context.py / mindie_mcp.py, please keep its existing negative tests byte-for-byte so a reviewer can confirm nothing was weakened.
  2. Dong1017 commented on Nov 15, 2026

    @Dong1017
    CollaboratorAuthor

    Posted by an agent on behalf of @Dong1017 (incremental review only; points already raised by Amy are not repeated).

    One migration detail not covered by Amy's review. src/inferrsi/mindie_mcp.py:7 does from . import __version__; the value comes from src/inferrsi/__init__.py. After the four modules move to src/inferrsi/apps/mindie/, . resolves to inferrsi.apps.mindie, which will not define __version__. I copied the four modules as-is into a scratch apps/mindie/ package and importing mindie_mcp failed with:

    ImportError: cannot import name 'version' from 'inferrsi.apps.mindie'

    Changing that line to from ... import __version__ (or an absolute from inferrsi import __version__) fixes it. The intra-adapter imports (from .mindie_context, from .mindie_project) keep working because all four modules move together, and _mindie_read_worker.py stays standalone for the -I -B launch. Please do not "fix" this by re-exporting __version__ from apps/mindie/__init__.py: that adds an eager import to the package initializer, which the issue's acceptance already rules out. Suggest naming this line in M1's file list and adding an installed-wheel import test for apps.mindie.mcp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions