markharness

0033: traceability defaults to reading the working tree

Status

Accepted (decided 2026-09-16). Extends the input source for the traceability command that 0032 introduced. The part making --at optional is replaced by 0043, which removes --at itself (the decision to read the working tree still stands). The part of decision 4 that excludes impact is replaced by 0046, which adds impact --worktree.

Background

0032 aligned traceability, impact, and coverage on reading only committed content at a given Git ref. The implemented traceability --at <ref> (defaulting to HEAD) reads via GitTreeKnowledgeSource, from Git objects — so it does not work until the target ref has at least one commit (on a freshly initialized, not-yet-committed repository, HEAD doesn’t resolve and git ls-tree fails).

This turned out to be impractical for a real markharness-view use case: a GUI or view that wants to show relations live while the user is editing Knowledge cannot demand a commit after every change — that breaks the editing loop entirely.

impact and coverage, by contrast, have no motivation to drop this constraint.

traceability has neither a two-point comparison nor an auditing requirement — it is simply “show me Knowledge’s current relations.” generate and verify already read the working tree directly via WorkingTreeKnowledgeSource; there is no inherent reason traceability alone has to require a Git ref.

Decision

1. --at becomes optional; omitting it reads the working tree

When markharness traceability is run without --at <ref>, it uses WorkingTreeKnowledgeSource (the same path generate and verify already use) instead of GitTreeKnowledgeSource, reading the working tree’s current content as-is. When --at <ref> is given, it reads that Git ref exactly as before, per 0032 decision 1.

The default changes from HEAD to “omitted” (no default_value on --at). “Omit it to read the working tree” matches the intuition generate and verify already establish.

2. The output’s at field distinguishes which source was read

When the working tree was read, at holds the fixed string "working-tree". When a Git ref was given, at holds that string exactly as the caller passed it, as before. This lets a reader tell which source produced a given result from the output alone.

"working-tree" plays the same kind of role record_kind does — an identifier that prevents mistaking one kind of record for another — and is treated as a reserved value that doesn’t collide with a Git ref name (the same practical risk already exists for HEAD and is accepted the same way).

3. Add a working-tree path for reading Requirements and Features

The current requirements_at/features_at (src/traceability.rs) only read via Git objects (git::ls_tree_recursive/git::show_blob_by_sha). Supporting the working tree needs an equivalent that reads directly from the filesystem. The concrete shape of that (separate functions, or an abstraction similar to KnowledgeSource) is left to the implementation phase, not decided here.

4. impact and coverage are out of scope

Extending working-tree support to either command has no confirmed concrete need today (YAGNI). If one appears later, it gets its own ADR at that point.

5. The output contract (record_kind, schema_version, field layout) is unchanged

This ADR only adds an input-source option; it does not touch TraceabilityReadModel’s field layout.

Consequences

Options considered and rejected