projio: model project code tiers in config (core_library + project_utils)¶
Context¶
Projects have a three-tier code architecture that projio should model explicitly:
- core_library (e.g.,
cogpyatcode/lib/cogpy/) — dataset-agnostic atomic compute functions. Reusable across projects. This is wherenb_promoteshould send library-worthy logic. - project_utils (e.g.,
code/utils/) — project-specific glue. Pipeline-architecture-aware helpers that don't fit into the core library (epoch helpers, matlab interop, notebook bootstrap). NOT pipeline wiring (that's pipeio's job now). - flow scripts (
code/pipelines/{flow}/scripts/) — snakemake wiring, one script per rule. Imports from tiers 1 and 2.
Currently:
- pipeio scaffolding (nb_create, script_create, mod_create) queries codio for kind=internal libraries but codio's catalog is empty
- codio's kind vocabulary doesn't distinguish between "I develop this" (cogpy) and "it's installed from elsewhere" (labbox)
- code/utils/ isn't tracked anywhere — it's not in code/lib/, not in codio, not in projio config
- The old utility-promote pixecog skill encoded placement heuristics in prose; those should be machine-queryable
Proposed config addition¶
# .projio/config.yml
code:
core_library: cogpy # code/lib/{name} — atomic compute, nb_promote target
project_utils: code/utils # project glue — PipelineContext, helpers
lib_dir: code/lib # where all libraries live (for auto-discovery)
Implementation¶
-
projio config model: Add
codesection to config schema. Parse in_load_config(). -
projio init / sync: Auto-discover
code/lib/*/directories and register in codio catalog: core_libraryvalue →kind: project_library(orrelationship: develop)- Other
code/lib/*/→kind: shared(installed, not developed here) -
Register
project_utilspath if it exists -
pipeio scaffolding: Query projio config (or codio) for:
nb_create→ import core_library + project_utils in bootstrapscript_create→ import core_library for compute functions-
nb_promote→ route extracted code: library-worthy → core_library, project glue → project_utils, flow-specific → scripts/ -
codio vocabulary: Either extend
kindenum (project_library,shared_library,external) or add arelationshipfield. The key question for agents: "can I add code to this library?"
What this replaces¶
The pixecog utility-promote skill's placement heuristics become machine-queryable:
- "Is this dataset-agnostic?" → core_library (cogpy)
- "Does it use PipelineContext/registry/snakemake?" → project_utils (code/utils)
- "Is it specific to one rule?" → flow script
Note on pixecog's code/utils¶
Much of utils.io (PipelineRegistry, PipelineContext, Session, Stage) has been superseded by pipeio. The remaining valuable parts are project-specific: notebook_bootstrap, brainstate epoch helpers, matlab interop. A cleanup pass should deprecate the pipeio-superseded parts.
Related Notes¶
- [[docs/log/issue/issue-arash-20260327-155921-977015.md]] — Directly related: codio bugs and unclear MCP docs — the current note proposes extending codio's kind vocabulary to distinguish internal vs external libraries
- [[docs/log/issue/issue-arash-20260326-232732-019412.md]] — Pipeio implementation issue — the current note mentions pipeio scaffolding tools (nb_create, script_create, mod_create) querying codio for kind=internal libraries
- [[docs/log/issue/issue-arash-20260331-172245-820267.md]] — MCP tools reference docs are undocumented — adding code tier config would require documenting new config schema and affected tools