Skip to content

Implementation Plan: Reorganize Flat Directories + Update CLAUDE.md#1734

Merged
Trecek merged 35 commits into
developfrom
reorganize-flat-directories-update-claude-md-to-match/1681
May 4, 2026
Merged

Implementation Plan: Reorganize Flat Directories + Update CLAUDE.md#1734
Trecek merged 35 commits into
developfrom
reorganize-flat-directories-update-claude-md-to-match/1681

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 3, 2026

Summary

Reorganize core/ and execution/ from flat file dumps into hierarchical subpackages.
core/ splits out types/ (13 _type_*.py files) and runtime/ (4 process-state files).
execution/ splits out headless/, process/, session/, and merge_queue/ — each using
the facade-as-__init__ pattern where the existing facade module becomes the subpackage's
__init__.py.

All external import surfaces are preserved. Import-linter contracts require no changes (new
subpackages remain inside their parent package's IL boundary). Test glob patterns referencing
flat file layouts are updated.

Closes #1681

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260503-112722-365868/.autoskillit/temp/make-plan/reorganize_flat_directories_plan_2026-05-03_113500_part_a.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step uncached output cache_read cache_write count time
analyze 43 3.2k 127.5k 22.5k 1 2m 29s
extract_domain 77 17.9k 381.2k 78.9k 1 7m 5s
generate_phases 139 11.2k 804.4k 49.5k 1 3m 21s
elaborate_phases 295 29.2k 1.3M 135.0k 3 14m 19s
refine_phases 93 18.5k 339.5k 47.6k 1 4m 57s
elaborate_assignments 2.4k 66.2k 3.0M 178.3k 3 23m 26s
refine_assignments 255 82.8k 1.1M 204.1k 3 25m 56s
Total 3.3k 229.0k 7.1M 715.8k 1h 21m

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
analyze 0
extract_domain 0
generate_phases 284 2832.5 174.3 39.6
elaborate_phases 0
refine_phases 0
elaborate_assignments 0
refine_assignments 0
Total 284 24980.7 2520.5 806.2

Trecek and others added 30 commits May 3, 2026 11:54
Move types.py → core/types/__init__.py and all 13 _type_*.py modules
into core/types/. Update 3 TYPE_CHECKING imports in execution/ that
referenced core._type_protocols_logging directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move kitchen_state.py, readiness.py, session_registry.py, and
_linux_proc.py into core/runtime/. Create runtime/__init__.py with
public re-exports. Update __init__.pyi stub paths and all test imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move session.py → session/__init__.py and _session_model.py,
_session_content.py, _session_outcome.py, _retry_fsm.py into
execution/session/. Update all internal cross-references and
_headless_result.py's direct imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move merge_queue.py → merge_queue/__init__.py and 3 _merge_queue_*.py
modules into execution/merge_queue/. Update all internal imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move process.py → process/__init__.py and 6 _process_*.py modules into
execution/process/. Update all internal cross-references and the
execution/__init__.py direct import of _process_kill.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move headless.py → headless/__init__.py and 5 _headless_*.py modules
into execution/headless/. Update all internal cross-references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update ~60 test files to reference new subpackage paths:
- autoskillit.core._type_* → autoskillit.core.types._type_*
- autoskillit.core.{kitchen_state,readiness,session_registry,_linux_proc}
  → autoskillit.core.runtime.*
- autoskillit.execution._process_* → autoskillit.execution.process._process_*
- autoskillit.execution._headless_* → autoskillit.execution.headless._headless_*
- autoskillit.execution._session_* → autoskillit.execution.session._session_*
- autoskillit.execution._merge_queue_* → autoskillit.execution.merge_queue._merge_queue_*

Update arch test EXEMPTIONS, hardcoded path tuples, and cross-layer
guard expectations. Add test_subpackage_structure.py for Part A.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix scripts/check_doc_counts.py path to _type_constants.py. Apply
ruff format/lint auto-fixes across touched files. Rearrange import
order in merge_queue/__init__.py and headless/__init__.py per isort.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…modules

readiness, kitchen_state, and _linux_proc were moved into core/runtime/ but
their MODULE_CASCADE_CORE entries were incorrectly removed. The cascade
lookup uses Path(f).stem which still yields the module name regardless of
subpackage depth, so the entries must remain. Also updates the readiness
test to use the new subpackage path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Modules moved to core/runtime/ (readiness, kitchen_state, _linux_proc) have
no MODULE_CASCADE_CORE entries — the phantom stem guard correctly prevents
stale entries. These modules now fall through to the full core cascade, which
is the intended fail-open behavior for subpackage files. Updated the
readiness test to verify full cascade instead of narrow cascade.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update recipe/__init__.py side-effect imports and validator.py re-export
shims to use the new autoskillit.recipe.rules.* paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update server/__init__.py bulk import block and _lifespan.py deferred
import to use the new autoskillit.server.tools.* paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert _doctor.py facade to doctor/__init__.py and move all 9
_doctor_*.py sub-modules alongside it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert _fleet.py facade to fleet/__init__.py and move _fleet_display,
_fleet_lifecycle, _fleet_session alongside it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create session/ with _cook, _order, _session_launch, _session_picker,
_reload. Update all intra-session and cross-subpackage references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move _ansi, _terminal, _timed_input, _menu to cli/ui/ and update all
importers across cli/, session/, fleet/, and flat modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move _update, _update_checks, _update_checks_fetch, _update_checks_source
to cli/update/ and update all internal and external importers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move 18 guard/gate/advisor scripts to guards/ and 5 formatter modules
to formatters/. Fix sys.path bootstraps for cross-directory bare imports.
Update hooks/__init__.py package-style imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Guards use guards/ prefix, formatters use formatters/ prefix.
Flat hooks (token_summary, quota_post, review_gate_post, session_start)
retain bare basenames.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update glob patterns (rules_*.py, tools_*.py), import paths, cascade
maps, EXEMPTIONS, hardcoded paths, and hook registration coverage tests
to match new subpackage locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…zation

Bulk update 114 test files with stale import paths after the Part B
reorganization that moved modules into subpackages:
- server/tools_*.py → server/tools/tools_*.py
- recipe/rules_*.py → recipe/rules/rules_*.py
- hooks/_fmt_*.py → hooks/formatters/_fmt_*.py
- hooks/*_guard.py → hooks/guards/*_guard.py
- cli/_doctor*.py → cli/doctor/
- cli/_fleet*.py → cli/fleet/
- cli/_cook.py etc → cli/session/
- cli/_ansi.py etc → cli/ui/
- cli/_update*.py → cli/update/

Also fixes hook_registry test (/ → . in module path), _ADVISORY_HOOKS
prefixes, architecture test globs/paths/exemptions, and hardcoded
hook script paths in subprocess-invoking tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…de phantom stems, and CLAUDE.md architecture tree
…architecture corrections

- Qualify *Def/*Spec location rules with "Typically" and exceptions
- Add Grep hook-inactive context qualification
- Update dataclass count 22→24 to match actual code
- Remove stale "pre-commit install" instruction from section 5
- Add section 3.6 Pyright LSP Usage with operation table
- Add dispatch_food_truck to tools_execution.py description
- Add missing _subprocess.py to server listing
- Define Channel B inline as "the JSONL stream written by the Claude Code subprocess"
- Add tests/docs/test_claude_md_structure.py validating all changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 7, 2026
Trecek added a commit that referenced this pull request May 8, 2026
…1734)

## Summary

Reorganize `core/` and `execution/` from flat file dumps into
hierarchical subpackages.
`core/` splits out `types/` (13 `_type_*.py` files) and `runtime/` (4
process-state files).
`execution/` splits out `headless/`, `process/`, `session/`, and
`merge_queue/` — each using
the facade-as-`__init__` pattern where the existing facade module
becomes the subpackage's
`__init__.py`.

All external import surfaces are preserved. Import-linter contracts
require no changes (new
subpackages remain inside their parent package's IL boundary). Test glob
patterns referencing
flat file layouts are updated.

Closes #1681

## Implementation Plan

Plan file:
`/home/talon/projects/autoskillit-runs/impl-20260503-112722-365868/.autoskillit/temp/make-plan/reorganize_flat_directories_plan_2026-05-03_113500_part_a.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code) via
AutoSkillit
<!-- autoskillit:pipeline-signature
steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr
-->

## Token Usage Summary

| Step | uncached | output | cache_read | cache_write | count | time |
|------|----------|--------|------------|-------------|-------|------|
| analyze | 43 | 3.2k | 127.5k | 22.5k | 1 | 2m 29s |
| extract_domain | 77 | 17.9k | 381.2k | 78.9k | 1 | 7m 5s |
| generate_phases | 139 | 11.2k | 804.4k | 49.5k | 1 | 3m 21s |
| elaborate_phases | 295 | 29.2k | 1.3M | 135.0k | 3 | 14m 19s |
| refine_phases | 93 | 18.5k | 339.5k | 47.6k | 1 | 4m 57s |
| elaborate_assignments | 2.4k | 66.2k | 3.0M | 178.3k | 3 | 23m 26s |
| refine_assignments | 255 | 82.8k | 1.1M | 204.1k | 3 | 25m 56s |
| **Total** | 3.3k | 229.0k | 7.1M | 715.8k | | 1h 21m |

## Token Efficiency

| Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC |
|------|-------------|----------------|-----------------|------------|
| analyze | 0 | — | — | — |
| extract_domain | 0 | — | — | — |
| generate_phases | 284 | 2832.5 | 174.3 | 39.6 |
| elaborate_phases | 0 | — | — | — |
| refine_phases | 0 | — | — | — |
| elaborate_assignments | 0 | — | — | — |
| refine_assignments | 0 | — | — | — |
| **Total** | **284** | 24980.7 | 2520.5 | 806.2 |

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Trecek added a commit that referenced this pull request May 8, 2026
…1974)

## Summary

_INFRA_UNCONDITIONAL_FILES in tests/_test_filter.py contains 9
filenames, but 3 of them (test_hook_executability.py,
test_hook_registration_coverage.py, test_hook_registry.py) live in
tests/hooks/, not tests/infra/. The path construction loop at line 1271
resolves all 9 under tests/infra/, silently dropping the 3 hook tests
from every tiered conservative filter run. The guard test in
test_test_filter_tiered_always_run.py checks only basenames (p.name),
masking the bug. This was introduced by commit 26c8059 (#1734) which
moved the files without updating the constant.

The fix splits the constant into two frozen sets with correct directory
mappings, adds a second path construction loop, and strengthens all
guard tests to assert parent directories.

## Implementation Plan

Plan file:
`/home/talon/projects/autoskillit-runs/impl-20260505-203325-376042/.autoskillit/temp/make-plan/fix_test_filter_hook_test_path_mismatch_plan_2026-05-05_203500.md`

## Changed Files

- tests/_test_filter.py
- tests/test_test_filter.py
- tests/test_test_filter_coverage_map.py
- tests/test_test_filter_tiered_always_run.py

Closes #1875

🤖 Generated with [Claude Code](https://claude.com/claude-code) via
AutoSkillit
<!-- autoskillit:pipeline-signature
steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr
-->

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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