Repository navigation
Conversation
…whose scope is the plan What happens between a ticket from intake and a Build Thread. Stacked on claude/factory-intake. - plan.py (pure): check_plan refuses a planner's output unless it is one strict JSON object naming files tracked at HEAD, new files that are not, steps and risks; a step or note with hidden markup, a credential shape or the shape of an order to an AI agent is refused. assess computes from the paths, never from the planner: the class floor (a policy of policy.json's shape), the files an agent reads as instructions, the components the paths belong to and what depends on them, and whether a test is among them. plan_route is an ordered rule list: an instruction file, a floor above auto, a sensitive component, a risk kept for people, or a plan over the limit waits for a person. - work.py: a ticket's status is derived from events each time it is asked (held, open, plan_held, plan_rejected, planned, claimed, working, ready). make_plan runs the planner command in a temporary checkout of HEAD under the environment intake gives a decider; a person can write a plan and it goes through the same checks. claim checks and appends under one acquisition of the ledger's lock, so one of two agents is refused. start writes a contract whose mutable scope is exactly the plan's files and starts an attended Build Thread; the kernel's scope rule refuses any other path. The thread's class is computed from the plan's paths, and its objective begins "Fixes owner/repository#N" for a GitHub issue. settle records, once, that the thread holds an accepted change. - work_cli.py: syberlabs factory work list|plan|show|approve|claim|release|start|settle. - intake.py: run_reader (with a working directory), credential_shapes, directive_shapes, strict_loads and named_command made public for this packet; a resolution's reason is also refused for a URL with a password in it. - AGENTS.md: "Work taken from a factory ticket", the four rules as what is refused. Nothing proposes, accepts, pushes, opens a pull request or merges. No model is called: tested with a stand-in planner (tests/test_factory_work.py, 35 tests; the factory simulation campaign). ledger.KINDS, the schemas and the golden traces are unchanged; the new events are note events. spec/GAPS.md entry 69 says what is open. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrJ4jU9Q3fnCogMET5bxs
Brings in 01ad07c, a test-only fix for a check that could fail by chance (a digest spelling the author's name). No change to this packet's code. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrJ4jU9Q3fnCogMET5bxs
…ature `work approve --by human:ID` checks that the actor's kind is human and binds the event to no key. The rule that a plan above auto waits for a person therefore holds against a planner and a builder that act through their commands, and not against a process that can run the approval itself. Stated in the limits of docs/FACTORY_WORK.md and in spec/GAPS.md entry 69 (10); the sentence comparing a label with an event no longer says more than that. Docs only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrJ4jU9Q3fnCogMET5bxs
…is an actor name a5e37d9 is a merge of claude/factory-intake that was committed by mistake with its conflict unresolved: spec/GAPS.md kept the conflict markers around entries 68 and 69, and the commit carried the message meant for the change below. This commit removes the markers (entry 68 as the intake branch has it, entry 69 as this branch has it) and makes that change: `work approve --by human:ID` checks that the actor's kind is human and binds the event to no key. The rule that a plan above auto waits for a person therefore holds against a planner and a builder that act through their commands, and not against a process that can run the approval itself. Stated in the limits of docs/FACTORY_WORK.md and in spec/GAPS.md entry 69 (10); the sentence comparing a label with an event no longer says more than that. Docs only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrJ4jU9Q3fnCogMET5bxs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admission
Class: C
Agent-platform: claude
Reviewed-by: none recorded
Admitted-by: none yet. This is the second half of the subsystem
claude/factory-intakestarts, and it adds a section toAGENTS.md; both are Class C, so an agent drafted this and a person with the key admits it or closes itEvidence: tested
Objective
What happens between a ticket from intake and a Build Thread: a plan is written before any code and checked by code, one agent claims the ticket, and the thread that builds it may change the plan's files and no others.
Stacked on
claude/factory-intake. The base of this pull request is that branch, so the diff shows this packet alone. It follows stations 4 and 5 of Daniel Moka's "Build Your Own Software Factory" (craftbettersoftware.com): a planning agent writes files, steps and risks, and the build keeps four rules. Here the four rules are refusals in code and records on the ledger, not labels an agent is asked to respect.What changed
syberlabs/factory/plan.py(new, pure: no I/O, no model)check_planrefuses a planner's output unless it is one strict JSON object naming existing files that are tracked at HEAD, new files that are not (case folded), steps and risks. A step or a note that holds hidden markup, a credential shape or the shape of an order to an AI agent is refused: a plan is text a model wrote after reading a request, so it goes through the screen the request went through.assesscomputes from the paths, never from the planner: the class floor of every path (a policy ofpolicy.json's shape; this repository's own file is one), the files an agent reads as instructions (CLAUDE.md,AGENTS.md,.mcp.json,.claude/**), the components the paths belong to (a file that does not exist yet belongs to every component whose declared globs match it), what depends on them, and whether a test is among the paths.plan_routeis an ordered rule list with two routes. A plan that names an instruction file, floors aboveauto, touches a sensitive component, names a risk kept for people (auth, secrets, payments, data, release, external effect), or is larger than the limit waits for a person.syberlabs/factory/work.py(new). A ticket's status is derived from events every time it is asked:held,open,plan_held,plan_rejected,planned,claimed,working,ready.make_planruns the planner command in a temporary checkout of HEAD (it can read the code, and nothing else of the operator's) under the environment intake gives a decider. A person can write a plan too; it goes through the same checks.approveis a human act on a held plan.claimandrelease: the check and the append are one acquisition of the ledger's lock, so of two agents claiming at once one is refused. A claim lapses after itsttl.startwrites a contract whose mutable scope is exactly the plan's files and starts an attended Build Thread on it. The kernel's existing scope rule then refuses any candidate that changes another path. The thread's class is computed from the plan's paths (auto R, auto with an evidence grade P, direction C, keys X), not declared. Its objective beginsFixes owner/repository#Nfor a GitHub issue.settlerecords, once, that the thread holds an accepted change. It accepts, pushes and merges nothing.syberlabs/factory/work_cli.py(new):syberlabs factory work list | plan | show | approve | claim | release | start | settle.syberlabs/factory/intake.py: helpers this packet needs made public (run_readerwith a working directory,credential_shapes,directive_shapes,strict_loads,named_command). One behavior change: a resolution's reason is now also refused for a URL with a password in it.syberlabs/factory/space.py:glob_to_regex, the existing matcher under a public name.AGENTS.md: a section, "Work taken from a factory ticket", with the four rules as what will be refused. It applies to ticket work only and says so.tests/test_factory_work.py(35 tests),tests/fixtures/intake/standin_planner.py, a work path in thefactorysimulation campaign, one more case intests/test_factory_intake.py.docs/FACTORY_WORK.md(new), updates todocs/FACTORY_INTAKE.mdanddocs/FACTORY.md, a row indocs/ROADMAP_STATUS.md,spec/GAPS.mdentry 69.The four rules
work claimrefuses a ticket with no plan, or with a plan that waits for a person (ticket_unplanned)ticket_claimed)candidate_out_of_scope)Fixes owner/repository#N, andpublish.pywrites the objective into the pull request bodyWhat did not change
ledger.KINDS, every schema, every golden trace, every admission rule. The new events arenoteevents.work startusesKit.startand the scope rule as they are; a person still accepts, and pushing, opening a pull request and merging are still separate acts.test_repository_layering_has_no_drift).Two texts that disagree, reported and not resolved
AGENTS.mdsays editingAGENTS.mdis Class C.policy.jsonfloorsAGENTS.mdat auto ("AGENTS.md and new spec identities are auto, as in the charter"). This pull request declares C, the higher of the two, and the plan rule for instruction files takes neither side: a plan from a stranger's request that rewrites what the next agent is told goes to a person whatever the floors say.Evidence
Run in a Linux sandbox, CPython 3.13.18, 2 CPUs, at
29f6b98, the packet's commit:The one failure is
test_console.ConsoleBrowser.test_the_purchase_order_path_completes_in_a_browser(page.waitForSelector: Timeout 30000ms). It fails the same way onmainat9abce6din this sandbox, so it is not this change.End to end, in
tests/test_factory_work.py::Building: triage a request, plan it (the planner cannot see an untracked file), claim it (a second agent is refused), start the thread, propose a change inside the plan (acceptable) and one outside (candidate_out_of_scope), accept, settle. The ticket isready,mainhas not moved, and the ledger verifies.38 defects were planted in
plan.pyandwork.pyone at a time. The tests catch each one.The branch has moved since, with no change to this packet's code.
tests.test_factory_work,tests.test_factory_intakeandtests.test_gaps(99 tests) reran at the head:d0a391fmerges the base branch's test fix (01ad07c).a5e37d9is a mistake of mine: a merge of the base branch's docs note, committed with its conflict inspec/GAPS.mdunresolved and under the wrong message. It was the head for about three minutes.b68cbcbrepairs it (the markers are gone, entries 68 and 69 are whole) and adds the limit "an actor is a name", below. Docs only. If you would rather not havea5e37d9in history, squash this pull request when it merges.CI on the head,
b68cbcb: every job is green:teston CPython 3.11, 3.12 and 3.13,windows,compose, G2 to G6, G8 and its strict run,policy, andadmit, the repository's own admission run on the head's exact tree (verdict: acceptable,all_checks_passed, ruleadmission.passed). The browser test that fails in the sandbox is skipped there (playwright for node is not installed, an allowed skip), so CI does not show it passing.Not run in the sandbox: Windows, CPython 3.11 and 3.12, PostgreSQL,
conformance.clean_install.Known limitations
work approve --by human:IDchecks that the actor's kind is human and binds the event to no key. So the rule that a plan aboveautowaits for a person holds against a planner and a builder that act through their commands, and not against a process that can run the approval itself.work startstarts the thread, then records it. A claim lost in between leaves a thread that is not recorded as the ticket's; the refusal names it.docs/FACTORY_WORK.md("Limits") andspec/GAPS.mdentry 69.Questions for the owner
claude/factory-intake.AGENTS.mdsection: is this the wording you want agents to read, and should every outside request pass through intake? The section does not say so; it covers ticket work only..github/**atdirectionwhen no policy file is passed.policy.jsondoes not list it.claude/factory-intake. Of everything open here, this is the one I would settle before agents run against a ledger they can write.Handoff
claude/factory-plan-claim, onclaude/factory-intake: the packet's commit, two merges of the base branch and the repair.claude/factory-review-queue(a queue for the person who merges, stacked on this branch). After that: a planning agent behind the planner command; claims across machines.https://claude.ai/code/session_01VHrJ4jU9Q3fnCogMET5bxs
Generated by Claude Code