Skip to content

The doctor reads where a file LIVES against where the policy puts it: a read-only placement audit row, code-in-spec and spec-in-code, with a plan the human resolves #99

Closed

Description

@brettheap

Lane: openreposhape-2 (openRepoShape-2)

Brett Heap, 2026-09-10, in session:

what about openRepoShape --doctor that will fix the repo back into the
correct 3leg version. we have to look for code in spec and spec in code…

The doctor landed READ-ONLY in #95 / PR #96 (→ 3d46ab5): a rows registry,
one verdict, and a fix slot that is None in every check. This issue is the
next slice of the sentence above, and it is the READING half only: a
placement audit row that answers "is there code in the spec leg and spec
in the code leg", names every offender with the rule that judged it, and
writes a plan the human resolves. It moves nothing. The --fix that
moves files is a later slice and needs the human's plan, because moving a
committed file between two repositories is two pull requests and a pin bump,
not an edit.

The row

New row id placement, on an assembly root (n/a on a family holder, whose
members each answer this in their own report; absent from the NOT A SHAPE ROOT
table). For each leg project.yaml declares that is mounted and populated:

  • git -C <leg> ls-files for the leg's tracked paths — one git call per leg,
    no per-file subprocess, so a leg with thousands of files still answers in
    seconds;
  • classify them with scripts/path_classify.py against
    contracts/path-classification.yaml — the same policy adopt-project.py plan uses, walked with adopt-project.py's own walk() by import, so
    there is no second copy of that classification to drift;
  • count what lands in the wrong place: the OTHER leg's class (code in spec,
    spec in code), root inside a leg, and review_required paths.

Paths that belong to EVERY repository are not judged: the four files
templates/spec-root/ and templates/code-root/ themselves ship
(README.md, AGENTS.md, CLAUDE.md, .gitignore) — read from the
templates at run time, so the standard's own scaffold can never produce a
finding — plus the front-door and forge furniture (LICENSE, NOTICE,
.gitattributes, CODEOWNERS, .github/**, …). The policy has no such list
of its own; the row defines it and --json prints it, so what was ignored is
readable rather than folklore.

Status, verdict, and the plan

  • ok when nothing is misplaced;
  • note when only review_required paths exist — they need a human's
    reading, not a fix, and note never moves the verdict;
  • FINDING when misplaced paths exist, and then the verdict is
    MISPLACED (n paths), exit 1, ordered after DRIFTED and before
    INVALID.

The row's reason names the first three offenders per direction
(spec/tool.py: code by rule extension-majority) and the totals; --json
carries the full list with path, leg, classified_as, rule and
review_required.

The next command is a NEW flag:

shape-doctor.py --root <path> --placement-plan placement-plan.yaml

It writes the offenders as an adoption-plan-style YAML — the same entry shape
adopt-project.py plan writes (path, leg, review_required, question),
plus in_leg: (where the file is now) and resolution: "" — so a person who
has resolved an adoption plan has resolved this one. It carries its OWN
kind: placement-plan deliberately: an adoption plan is executed by
adopt-project.py execute, which creates repositories and cuts history, and a
file that named itself one would be a loaded gun pointed at an assembly root
that is already split. The adoption tool refuses it by name and says which
tool consumes one.

A future shape-doctor.py --fix --plan <file> executes a RESOLVED plan by
paired leg pull requests and one root pin bump, after printing what it will do
and getting a typed yes — the posture update-shape.py apply takes. Today the
moves are the human's, and the doctor says so.

Tests

A scaffolded project with clean legs is ok and still COMPLIANT; a .py
under spec/ and a requirements/*.md under code/ give MISPLACED (2 paths), exit 1, both named with their rules and both in --json;
--placement-plan writes a file whose entries the adoption tool's own reader
accepts, refusing only on the unresolved ones; a review_required path alone
is note and COMPLIANT; a family holder is n/a; the row is absent from
the NOT A SHAPE ROOT table. Plus the real estate, read-only, in the report.

Follows #95 (PR #96). Related: #97 (docs/cli.md regenerates from --help).

Activity

  1. brettheap commented on Sep 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openreposhape-2 (openRepoShape-2), session 8fa66b30-4cf5-4b80-b40c-ac3640cf45ab, 2026-09-11T03:05Z, for the whole of this issue, branch feat/doctor-placement-audit.

    The three reads Rule 1 asks for, and what they returned:

    1. Claims and comments on the governing record — this issue was opened by
      this lane minutes ago (The doctor reads where a file LIVES against where the policy puts it: a read-only placement audit row, code-in-spec and spec-in-code, with a plan the human resolves #99) and carries no other comment. gh issue list --repo opensoft/openRepoShape --state all --search "placement" returns The per-user workspace repository: <user>-wip as a naming form, one per person in the home org by default, a per-org override for work that must stay inside its org (follows #77) #81
      and Continuing in-flight feature work on another workstation: park/resume over pushed branches, a per-user workspace manifest in a repository the person owns, and handoffs that travel (companion to #76) #77, both about the <user>-wip workspace form and both CLOSED; neither
      is about path placement inside the legs. --search "doctor" returns One command answers whether a repository is compliant with openRepoShape, and what is missing when it is not #95
      (CLOSED, the read-only doctor this follows), docs/cli.md: a flag-level CLI reference for an agent, GENERATED from every shipped tool's --help, with a hygiene test that fails when the committed file drifts from what the generator produces #97 (OPEN, docs/cli.md), The preflight offers to install what is missing and starts the login: a guided first run, --doctor (after #50) #59,
      openRepoShape command: workdir() sets its EXIT trap inside a $(...) subshell, so the temp dir is gone before setup.sh lands in it — every fetching run refuses (--doctor, the scaffold, curl | bash --install) #74 and Family workstation layout: a plain <Family>/ folder holding the holder and the members' working clones — family.py init lands there, the scaffold learns --family, the holder gains a siblings utility that warns and never moves #76 — none claims this object.
    2. gh pr list --repo opensoft/openRepoShape --state all --search "placement"
      — no PR about path placement. The nearest is docs/cli.md: every shipped tool's --help and every subcommand's in one file for an agent, GENERATED by scripts/render-cli-reference.py, with a test that fails when the committed file drifts (#97) #98 (OPEN, docs/cli.md,
      branch docs/cli-reference), which touches shape-doctor.py not at all but
      REGENERATES a file from its --help; this lane will merge origin/main and
      re-run scripts/render-cli-reference.py before opening its own PR if that
      one has landed.
    3. git ls-remote --heads origin | grep -iE 'placement|doctor' — nothing. The
      branch feat/doctor-placement-audit does not exist on the remote yet.

    Working in a linked worktree cut from origin/main at 3d46ab5; the shared
    checkout belongs to another session and is not touched. Read in full before
    authoring: shape-doctor.py, scripts/path_classify.py,
    contracts/path-classification.yaml, adopt-project.py (Source, Entry,
    walk, render_plan, Plan, cmd_check, _leg_findings),
    tests/test_shape_doctor.py, tests/conftest.py, the README's doctor
    subsection, docs/handbook.html's #doctor section, AGENTS.md § "Checking a
    repository's compliance", and the caps and handbook guard in
    tests/test_repo_hygiene.py.

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