core / workspace_model.py — WorkspaceModel

Structured snapshot of sandbox state so the agent doesn't re-read every file every turn.

Data shapes

TypeFields
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

MethodPurpose
scan(sandbox_dir) -> WorkspaceDiffWalk 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) -> strReturn 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) -> strMarkdown section for prompt injection.
advance_turn()Increment internal turn counter.

Skip rules

The scanner ignores hidden directories, __pycache__, node_modules, and .git. Synchronous.