Skip to content

reflector: port karpathy-loop's bounded reflection pattern#1

Closed
jaschadub wants to merge 2 commits into
mainfrom
worktree-karpathy-loop-learnings
Closed

reflector: port karpathy-loop's bounded reflection pattern#1
jaschadub wants to merge 2 commits into
mainfrom
worktree-karpathy-loop-learnings

Conversation

@jaschadub
Copy link
Copy Markdown
Contributor

@jaschadub jaschadub commented Apr 19, 2026

Closed — superseded by #2 (same branch, rewritten history, clean commit messages).

symbi and others added 2 commits April 19, 2026 11:29
Borrow symbiont-karpathy-loop's post-phase reflector idea into the pen
test pipeline. Between phases the controller now invokes a bounded
reflector agent that reads the phase's findings and writes
subject-predicate-object lessons to a new `knowledge` table. The next
phase's agent recalls those lessons before planning so learning flows
forward across the engagement without any agent mutating another's
tools or policy.

Boundary is enforced the same way as in karpathy-loop: Cedar's
`reflector.cedar` uses `forbid ... unless` defensive negation to keep
the reflector's surface bounded to `store_knowledge`,
`recall_knowledge`, and `query_findings`. Every scan/enum/exploit/post-
exploit action is rejected at the gate even if someone later widens a
permit elsewhere. The reflector's DSL capabilities list is the second
layer: it declares nothing it could use to act on targets.

Changes:
- db/schema.sql, src/db.rs: `knowledge` table + typed insert/recall
- src/knowledge_tools.rs: `store_knowledge` + `recall_knowledge` MCP
  tools, gated on `PenTest::KnowledgeStore`
- agents/reflector.dsl + policies/reflector.cedar: bounded agent
- agents/{recon,enum,vuln-assess,exploit,post-exploit,reporter}.dsl:
  add `recall_knowledge` capability + phase-entry recall
- agents/engagement-controller.dsl: invoke reflector after each phase
- policies/tool-authorization.cedar: authorize `recall_knowledge`
  globally (LOW risk, read-only)
- policies/evidence.cedar: exempt knowledge tools from the pending-
  tool-runs backlog check
- tests: db round-trip, reflector policy shape assertions, knowledge
  tool registration checks
- AGENTS.md: updated agent hierarchy, key files, and tool roster

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Agent count 7 → 8; hierarchy shows reflector between phases and
  reporter, with a short paragraph on what it does and how it's bounded.
- MCP tool count 31 → 35 in the architecture diagram.
- Policy table adds reflector.cedar with its defensive forbid-unless
  note; count 7 → 8.
- Data layer section introduces the knowledge store next to findings
  and evidence, with one concrete triple example.
- Repository structure shows reflector.dsl and knowledge_tools.rs.
- Key design decisions gains a "bounded reflector" entry.
- Capability comparison table gains a cross-phase-learning row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jaschadub
Copy link
Copy Markdown
Contributor Author

Closing to re-open with clean commit history (no tooling mentions).

@jaschadub jaschadub closed this Apr 19, 2026
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