cgis_suggest_packages
Suggests sub-package boundaries for a Python or TypeScript package by clustering its dependency communities, returning a verdict to split, consolidate, or leave the layout aligned.
Instructions
Suggest sub-package boundaries for a package from its dependency communities.
Returns JSON: modularity_q, divergence, direction (under/over/matched),
verdict (split/consolidate/aligned/leave/borderline/no_signal), the detected
communities (id + members), the cross-community bridge edges (cost of
splitting), and the thresholds used. Default layer is IMPORTS; set
``with_calls`` for the combined import+call graph. Run ``cgis_ingest`` first.
Members are the package's direct children by default, each sub-package one
node, so the verdict says whether to regroup them; ``level`` in the result
says which. ``all_descendants`` clusters every file below the package.
A mis-rooted graph (import targets resolve to no internal file) returns
``no_signal`` with a diagnostic note rather than a silent clean verdict.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| min_q | No | Modularity threshold: at or above it, a package whose layout disagrees with its communities is flagged split (or consolidate, if over-split). | |
| prefix | No | FQN prefix of the package to analyse, e.g. cgis.query, matched on whole dot-segments. Needed in practice: without it the verdict is no_signal. | |
| db_path | No | SQLite graph built by cgis_ingest. A relative path resolves against the MCP server's working directory, not the agent's — prefer an absolute path. | graph.db |
| with_calls | No | Use the combined import + call graph instead of imports only. | |
| all_descendants | No | Cluster every file below the package and compare with its sub-directories, instead of treating each sub-package as one node. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |