Repository navigation
Add project knowledge documents (upload .md files for the agent) - #302
zwanski-start wants to merge 2 commits into
Conversation
Markdown/text files stored in .autoforge/knowledge/ are listed at the top of
every agent prompt so the agent reads them before planning or coding. Adds a
REST API (list/read/upload/delete) under /api/projects/{name}/knowledge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Book button in the agent controls opens a modal to upload (picker or drag & drop), preview and delete .md/.txt knowledge documents for the project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔍 QA report: ✅ PassedTester: Barbara (cubefarm agent, in a fresh session) · Round: 1 · Author: Dennis Project knowledge documents work end to end. Uploading in the new modal (file picker, several files at once) cleans filenames as described, rejects non-markdown files, updates the count badge, previews and deletes. Every agent prompt starts with a PROJECT KNOWLEDGE section listing the docs and is unchanged when there are none. Lint, the new tests, the security suites and the UI build pass; the only pytest failures are the 21 that also fail on master, and mypy shows no new errors. Minor, non-blocking: the server accepts a filename with a trailing newline because re.match with '$' matches before a final newline (use re.fullmatch).
🧪 Commands run
No browser screenshots were taken in this round. Posted by cubefarm · merges automatically once GitHub's checks pass |
Upload markdown/text documents (requirements, research notes) to .autoforge/knowledge/ from the agent controls; every agent prompt starts with a list of them. Adaptations on integration: - every file access goes through api/safe_project_io: .autoforge/ is agent-writable, so a symlink or hard link planted in knowledge/ is never read (409), written through (the link is replaced) or deleted through; the listing and the prompt pointer skip links; - the knowledge directory must resolve inside the project (resolve() + is_relative_to, as in server/routers/documentation.py); - tests for the link cases. Integrates AutoForgeAI#302 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
Closes #22
What changed
You can already attach
.mdfiles in the spec-creation and expand-project chats, but only for that one conversation. This PR adds project knowledge documents that stay with the project and that every agent session uses.{project}/.autoforge/knowledge/(autoforge_paths.get_knowledge_dir). The folder is not gitignored, so the docs are versioned with the project.prompts.with_project_knowledge()puts a## PROJECT KNOWLEDGEsection at the top of every agent prompt (initializer, coding, single/batch, testing, auto-improve). The section lists the docs and tells the agent to read them before planning or coding. Files are referenced by path, not pasted in, so large docs don't bloat every prompt. The agent already hasRead(./**)access. If there are no docs, the prompt stays exactly the same.server/routers/knowledge.py), under/api/projects/{name}/knowledge:GETlists the filesGET /{filename}returns a file's contentPOST {filename, content}creates a file or overwrites one with the same nameDELETE /{filename}removes a file.md,.markdownand.txt. Filenames are checked against a strict regex (no path separators, no.., no leading dot). Each file is limited to 1 MB and each project to 50 files.Research Notes (v2).mdbecomesResearch Notes _v2_.md.Verification
test_knowledge.pywith 10 pytest tests: the prompt section, upload/list/read/overwrite/delete, rejection of bad filenames, the size limit and unknown projects. All pass.ruff check .is clean. mypy reports no new errors in the changed files; the errors it does report are already on master.npm run lintshows no new warnings andnpm run buildsucceeds.Research Notes (v2).md, and saw it stored as.autoforge/knowledge/Research Notes _v2_.md. The count badge and the preview worked. The initializer prompt started with the knowledge section listing the file, and deleting through the API left the list empty.Assumptions
🤖 Generated with Claude Code