agora.core.role_scope

Role write-scope rules — the single source of truth for who may write where.

Position: the write-permission oracle both the runtime guard and flow validation consult. Deliberately import-light (only AgentRole) so it can be called from either layer without a cycle.

Invariant (why it exists as one module): two independent call sites must apply the SAME rule, or a flow that lints clean can still be rejected at runtime —

  • agora.fleet.inner_tools._enforce_path_scope() (runtime write guard);

  • flow validation (agora.core.flow.load_flow()), a load-time lint that refuses a task assigned to a role that cannot write its own declared output.

Findings this encodes:
  • F1 — two role systems collided: this v2.7 “turf” rule (legacy architect/implementer/tester/reviewer pipeline) silently rejected all 17 write_file calls of the integration-run-1 T5.1 task, whose output_path was tests/test_core.py — an implementer writing the tester’s turf.

  • F2 — that feasibility (can this role write its declared output?) is statically checkable, so the collision is now caught at LOAD time by the lint above rather than as invisible runtime rejections.

Scope rules (v2.7):
  • implementer may not write tests/** (tests are the tester’s turf).

  • tester may not write src/** (implementation is the implementer’s).

  • architect / reviewer / unknown: unrestricted.

Functions

role_can_write(role, rel)

True iff role is permitted to write the work_dir-relative path rel.

write_scope_reason(role, rel)

Short reason a write is out of scope (empty when it is allowed).

agora.core.role_scope.role_can_write(role, rel)[source]

True iff role is permitted to write the work_dir-relative path rel.

agora.core.role_scope.write_scope_reason(role, rel)[source]

Short reason a write is out of scope (empty when it is allowed).