Skip to content

docs: fold the Rules feature spec into the codebase#16

Merged
brendan-ch merged 2 commits into
mainfrom
chore/update-agent-docs
Jun 19, 2026
Merged

docs: fold the Rules feature spec into the codebase#16
brendan-ch merged 2 commits into
mainfrom
chore/update-agent-docs

Conversation

@brendan-ch

@brendan-ch brendan-ch commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Folds the standalone Docs/AGENT_RULES_FEATURE_SPEC.md (~620 lines) into the
codebase itself
, so the rules-feature spec lives where contributors actually
work and is maintained alongside the code it describes.

The key realization while doing this: the codebase already documented its
behavior thoroughly in /// doc comments on each type. So "folding the spec in"
was mostly recognizing that, adding the few durable details the comments
lacked, and replacing the parallel Docs file with navigation + ownership
wiring — not bulk-pasting prose (which would have duplicated what the code
already says).

What changed

  • Behavioral spec → /// doc comments on the source each topic owns. A few
    genuinely-missing rationales were added: the Schedule-only reasoning in
    RuleConfiguration, the Allow-Only "can't punch a hole" invariant in
    ShieldController, and the full "strictest enforcement wins" invariant
    (formerly §4.8) in RuleEnforcer.
  • Docs/AGENT_RULES_FEATURE_SPEC.md removed. Its un-foldable residual
    (concept pointer, screen tree, topic → source map, out-of-scope) now lives
    as a "Rules feature map" section in AGENTS.md — the thin agent directory
    — so there is no parallel spec file to drift.
  • Ownership reframed (AGENTS.md, CLAUDE.md, AGENT_SWIFT_GUIDELINES.md):
    the spec is co-maintained with the code — update the owning file's doc comment
    in the same commit as the behavior change.
    The doc-ownership contract gained a
    "shared (human + agent)" bucket for it.

Net: Docs/ now holds only AGENT_SWIFT_GUIDELINES.md; the spec is the code
plus a one-screen map. The pre-reskin custom design is preserved in git history.

Test plan

  • Build green (Xcode MCP, iOS simulator)
  • Full unit suite: 240 / 240 pass
  • No dangling references (AGENT_RULES_FEATURE_SPEC, RULES_SPEC, § all
    resolved or removed)
  • Every file path in the AGENTS.md map verified to exist on disk
  • Maintainer skims the rendered AGENTS.md "Rules feature map" and a couple
    of the folded doc comments to confirm the structure reads well

🤖 Generated with Claude Code

https://claude.ai/code/session_012E73uBVKkqL25RJrF7tfmm

brendan-ch and others added 2 commits June 19, 2026 18:56
Replace the standalone Docs/AGENT_RULES_FEATURE_SPEC.md with the spec
living where it belongs — as /// doc comments on the source each topic
owns — and slim the central doc to Docs/RULES_SPEC.md, a navigational
index: concept, current navigation map, the §4.8 cross-cutting "strictest
wins" invariant, the background-architecture overview, a topic → source
table, and a historical appendix for the pre-reskin custom design.

The codebase already documented its behavior thoroughly in doc comments,
so this mostly recognizes that and makes it navigable. A few durable
details were added where the spec was richer than the code: the
Schedule-only rationale in RuleConfiguration and the Allow-Only
"can't punch a hole" invariant in ShieldController.

Reframe doc ownership (AGENTS.md, CLAUDE.md, AGENT_SWIFT_GUIDELINES.md):
the rules spec is now human-owned and co-maintained — update the owning
file's doc comment in the same commit as the code. Adds a "shared" bucket
to the AGENT_-prefix contract so RULES_SPEC.md is editable by both humans
and agents.

Build green; 240/240 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012E73uBVKkqL25RJrF7tfmm
Fold the standalone Docs/RULES_SPEC.md into AGENTS.md as a "Rules feature map"
section — AGENTS.md is the thin agent directory, so the spec's un-foldable
residual (concept pointer, screen tree, topic → source table, out-of-scope)
belongs there rather than in a parallel Docs file.

The §4.8 "strictest enforcement wins" invariant goes the other way — into the
RuleEnforcer doc comment that owns it — so the only remaining cross-cutting
prose is the map itself.

Removes Docs/RULES_SPEC.md; points CLAUDE.md and AGENT_SWIFT_GUIDELINES.md at
the map; drops the now-dangling "spec §4.8" references in RuleEnforcer /
ShieldController / RuleEnforcerTests (the invariant now reads self-contained in
RuleEnforcer). The pre-reskin design remains recoverable from git history.

Build green; 240/240 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012E73uBVKkqL25RJrF7tfmm
@brendan-ch brendan-ch merged commit 1e35aae into main Jun 19, 2026
1 of 2 checks passed
@brendan-ch brendan-ch deleted the chore/update-agent-docs branch June 19, 2026 23:40
brendan-ch added a commit that referenced this pull request Jun 20, 2026
Resolve conflicts from PR #16 (feature spec folded into source doc comments):
- AGENTS.md: adopt main's three-bucket Documentation structure; keep the
  Docs/Agents/ ownership-by-location note; add the OpenAppLockReport extension,
  DayStartStore, and an authoritative-usage row to the layout + feature map.
- Docs/AGENT_RULES_FEATURE_SPEC.md: accept main's deletion — the hardening
  behavior is already documented in source doc comments (DayStartStore,
  LimitEnforcement, MonitoringPlan, the report files, RuleEnforcer).
- Retarget the design spec's references from the deleted file to the new
  doc-comment convention.
RuleEnforcer.swift and RuleEnforcerTests.swift auto-merged cleanly.

Merged tree builds; 253/253 unit tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TD4vdHbB8KqLPGYNbYNS5U
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