feat: add re:factory persistent supervisor agent (#728)#754
Open
xukai92 wants to merge 10 commits into
Open
Conversation
Sentrux Quality ReportAbsoluteDiff (vs base branch) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #754 +/- ##
==========================================
+ Coverage 86.75% 86.86% +0.11%
==========================================
Files 79 81 +2
Lines 11881 12203 +322
==========================================
+ Hits 10307 10600 +293
- Misses 1574 1603 +29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@ceo-review |
There was a problem hiding this comment.
✅ Factory Review: KEEP
Verdict: KEEP
Reason: Persistent refactory supervisor agent with full session management, context/compaction skills, and playbook evolution. All tests pass (2597/2597) including 19 new tests. 2 LOW severity issues are acceptable patterns. All acceptance criteria verified.
Score Comparison
| Metric | Value |
|---|---|
| Before | 0.4282 |
| After | 0.4282 |
| Delta | +0.0000 |
| Threshold | 0.8000 |
Code Review Notes
- qa_verdict=ISSUES_FOUND
- qa_issues_count=2
- qa_issues_severity=LOW
- tests_pass=2597/2597
- lint_pass=yes
- acceptance_criteria=4/4
- issues=unreachable_wizard_code+temp_file_leak_with_execvp
- smoke_test=PASS
- edge_cases=9/9_PASS
Posted by Factory CEO
Introduces the re:factory persistent supervisor agent — a layer above the CEO that manages CEO lifecycles, context/compaction, and playbooks. Phase 1: Agent prompt (refactory.md), workspace module (refactory.py), AgentRole registration, agents.yml config, CLI subcommand + bare `factory` entry point. Phase 2-3: Four slash-command skill files (factory-run, sessions, compaction, playbook) copied to workspace on setup, giving the agent dispatch, monitoring, context preservation, and ACE evolution abilities. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 test cases covering setup_workspace (directories, settings.json, CLAUDE.md, skill copying, idempotency), session ID lifecycle (create, existing, reset, roundtrip), agent role registration (AgentRole type, agents.yml), and CLI integration (subcommand parsing, prompt resolution). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add "refactory" to _WORKSPACE_WRITE_ROLES in plugin.py so Codex sandbox mode handles the new role - Update test_tty_launches_wizard to mock cmd_refactory instead of _welcome_wizard, matching the new bare `factory` behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code's --session-id flag requires standard UUID format (with dashes), not hex-only. Found during E2E testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add TestCmdRefactory: no_claude error, new/existing session resume flag, reset flag, model forwarding (all mock os.execvp) - Add test_corrupt_json_generates_new for the except branch - factory/refactory.py now at 100% coverage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code CLI doesn't support --cwd. Change to os.chdir(workspace) before os.execvp instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code doesn't allow --session-id combined with --resume. New sessions: --session-id <uuid> (sets the ID). Existing sessions: --resume <uuid> (resumes by ID). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move refactory workspace from global ~/.factory/refactory/ to per-project .refactory/ so each project gets its own session and config. Add sop-compact PreCompact and SessionStart hooks so the agent survives context compaction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bare `factory` now checks for .git/ — launches refactory in git repos, wizard otherwise. Split test into two: git repo and non-git-repo cases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The refactory agent is fully trusted within its project workspace, same as the board agent in refactory-server. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
732a492 to
fab6b4d
Compare
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.
Summary
factorycommand (no subcommand) now launches the refactory agent instead of the welcome wizard/factory-run(dispatch),/sessions(tracking),/compaction(context preservation),/playbook(ACE evolution)Files changed
factory/agents/prompts/refactory.md— agent system prompt (149 lines)factory/refactory.py— workspace setup + session management modulefactory/agents/skills/— 4 skill files (factory-run, sessions, compaction, playbook)factory/agents/runner.py— added "refactory" to AgentRolefactory/agents/agents.yml— added refactory role configfactory/cli.py— added cmd_refactory + wired barefactoryto launch ittests/test_refactory.py— 13 test casesTest plan
uv run pytest tests/test_refactory.py -v— 13/13 passuv run pytest tests/test_prompts.py -v— 71/71 pass (no regressions)ruff check factory/refactory.py factory/agents/runner.py— cleanCloses #728
🤖 Generated with Claude Code