core / workspace_model.py — WorkspaceModel
Structured snapshot of sandbox state so the agent doesn't re-read every file every turn.
Data shapes
| Type | Fields |
|---|---|
FileState (line 21) | path · size · content_hash · file_type · last_modified · last_read_turn · summary · columns · row_count |
WorkspaceDiff (line 47) | added · removed · modified lists, plus a summary() helper |
API
| Method | Purpose |
|---|---|
scan(sandbox_dir) -> WorkspaceDiff | Walk filesystem, stat files, return diff vs. last snapshot. |
record_read(path, summary, columns, row_count) | Mark a file as inspected this turn. |
record_write(path, summary) | Note an outgoing write. |
what_do_i_know(path) -> str | Return cached summary so the LLM doesn't re-read. |
what_am_i_missing(goal) -> List[str] | Keyword-match unread files to the current goal. |
get_recently_modified(turns_back=3) | Files touched in the last N turns. |
get_context_for_prompt(max_files=20) -> str | Markdown section for prompt injection. |
advance_turn() | Increment internal turn counter. |
Skip rules
The scanner ignores hidden directories, __pycache__, node_modules, and .git. Synchronous.