Pack · files
files.toolset
The file tools an agent calls, as conceptual tools a harness binds its own tools to: read_file, write_file, edit_file, list_dir, search, move, copy and delete. Each tool is one command, typed by its input, its answer and its effect: which file it reads, creates, changes or removes. A file lives in a workspace (agentic.workspace). Every tool that writes names a live lease of that workspace and is refused without one; reading needs none. An edit names the content it expects, so an edit over a file that changed since it was read is refused. Which concrete tool of which harness plays a conceptual tool is a binding, not this block.
Depends on
Used by
No block depends on this one.
Entities
File
One file in one workspace, with the digest of its content.
Identified by file_id (FileId).
| field | type | meaning |
|---|---|---|
workspace_id | WorkspaceId | |
path | Path | |
content | Content | |
executable | boolean | |
last_lease_id | LeaseId | The lease the last write was made under. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Relations:
workspacereferences Workspace of workspace (one, byworkspace_id)last_leasereferences Lease of workspace (one, bylast_lease_id)
Lifecycle: one state, Present; a recorded File does not change.
Commands
CopyFile
copy. Copies one file to a new path in the same workspace. Input: the source, the new file, the workspace, a lease, the new path. Effect: a new File with the source's content.
Called by: File tool.
| field | type |
|---|---|
file_id | FileId |
source_file_id | FileId |
workspace_id | WorkspaceId |
lease_id | LeaseId |
to | Path |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
exists refused | the File exists already | File: A file of this identity exists. write_file creates a file; replacing a whole file is edit_file with a Whole edit. |
no-such-source refused | no File for source_ | File: No file of this identity exists. |
unknown-lease refused | no Lease for lease_ | Unknown: No lease of this identity exists. |
source-in-other-workspace refused | the File of source_ has workspace_ | Other: The file lives in another workspace than the one named. |
lease-not-live refused | the Lease of lease_ has state != Live | Lease: The lease is requested, released or expired; nothing is written under it. |
lease-of-other-workspace refused | the Lease of lease_ has workspace_ | Lease: The lease is a lease of another workspace. |
path-taken refused | a File with workspace_ | Path: Another file of the workspace holds this path. |
copied | otherwise | creates a File in Present; emits File |
More columns: swipe horizontally, or focus the table and use the arrow keys.
DeleteFile
delete. Removes one file. Input: the file, its workspace, a lease. Effect: the File is gone.
Called by: File tool.
| field | type |
|---|---|
file_id | FileId |
workspace_id | WorkspaceId |
lease_id | LeaseId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-file refused | no such File | File: No file of this identity exists. |
other-workspace refused | workspace_ | Other: The file lives in another workspace than the one named. |
unknown-lease refused | no Lease for lease_ | Unknown: No lease of this identity exists. |
lease-not-live refused | the Lease of lease_ has state != Live | Lease: The lease is requested, released or expired; nothing is written under it. |
lease-of-other-workspace refused | the Lease of lease_ has workspace_ | Lease: The lease is a lease of another workspace. |
deleted | otherwise | emits File |
More columns: swipe horizontally, or focus the table and use the arrow keys.
EditFile
edit_file. Changes one file by a line range, by replacing an anchor that occurs once, or as a whole. Input: the file, its workspace, a lease, the content it expects and the edit. Answer: the new content. Effect: the File's content.
Called by: File tool.
| field | type | meaning |
|---|---|---|
file_id | FileId | |
workspace_id | WorkspaceId | |
lease_id | LeaseId | |
expected | string | The digest of the content the edit was made against. |
edit | Edit | |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-file refused | no such File | File: No file of this identity exists. |
other-workspace refused | workspace_ | Other: The file lives in another workspace than the one named. |
content-changed refused | content. | Content: The file's content is no longer the content the edit expected: it changed since it was read. |
unknown-lease refused | no Lease for lease_ | Unknown: No lease of this identity exists. |
lease-not-live refused | the Lease of lease_ has state != Live | Lease: The lease is requested, released or expired; nothing is written under it. |
lease-of-other-workspace refused | the Lease of lease_ has workspace_ | Lease: The lease is a lease of another workspace. |
does-not-apply refused | the anchor does not occur exactly once, or the range lies outside the file | Edit: The anchor does not occur exactly once, or the line range lies outside the file. Decided by the tool on the file's content, which this block holds only as a digest. |
edited | otherwise | updates the File; emits File |
More columns: swipe horizontally, or focus the table and use the arrow keys.
ListDir
list_dir. Lists one directory of a workspace. Input: workspace, directory. Answer: its entries. Effect: none.
Called by: File tool.
| field | type |
|---|---|
workspace_id | WorkspaceId |
directory | Path |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
unknown-workspace refused | no such Workspace | Unknown: No workspace of this identity exists. |
listed | otherwise | leaves the Workspace as it is |
More columns: swipe horizontally, or focus the table and use the arrow keys.
MoveFile
move. Gives one file another path. Input: the file, its workspace, a lease, the new path. Effect: the File's path.
Called by: File tool.
| field | type |
|---|---|
file_id | FileId |
workspace_id | WorkspaceId |
lease_id | LeaseId |
to | Path |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-file refused | no such File | File: No file of this identity exists. |
other-workspace refused | workspace_ | Other: The file lives in another workspace than the one named. |
unknown-lease refused | no Lease for lease_ | Unknown: No lease of this identity exists. |
lease-not-live refused | the Lease of lease_ has state != Live | Lease: The lease is requested, released or expired; nothing is written under it. |
lease-of-other-workspace refused | the Lease of lease_ has workspace_ | Lease: The lease is a lease of another workspace. |
moved | otherwise | updates the File; emits File |
More columns: swipe horizontally, or focus the table and use the arrow keys.
ReadFile
read_file. Reads one file. Input: the file. Answer: its path, content and whether it is executable. Effect: none.
Called by: File tool.
| field | type |
|---|---|
file_id | FileId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-file refused | no such File | File: No file of this identity exists. |
read | otherwise | leaves the File as it is |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Search
search. Finds text in the files of a workspace. Input: workspace, pattern, an optional directory to search under. Answer: the matches, with path, line and excerpt. Effect: none.
Called by: File tool.
| field | type |
|---|---|
workspace_id | WorkspaceId |
pattern | string |
under | optional Path |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
unknown-workspace refused | no such Workspace | Unknown: No workspace of this identity exists. |
searched | otherwise | leaves the Workspace as it is |
More columns: swipe horizontally, or focus the table and use the arrow keys.
WriteFile
write_file. Creates one file. Input: workspace, lease, path, content. Effect: a new File.
Called by: File tool.
| field | type |
|---|---|
file_id | FileId |
workspace_id | WorkspaceId |
lease_id | LeaseId |
path | Path |
content | Content |
executable | boolean |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
exists refused | the File exists already | File: A file of this identity exists. write_file creates a file; replacing a whole file is edit_file with a Whole edit. |
unknown-workspace refused | no Workspace for workspace_ | Unknown: No workspace of this identity exists. |
unknown-lease refused | no Lease for lease_ | Unknown: No lease of this identity exists. |
lease-not-live refused | the Lease of lease_ has state != Live | Lease: The lease is requested, released or expired; nothing is written under it. |
lease-of-other-workspace refused | the Lease of lease_ has workspace_ | Lease: The lease is a lease of another workspace. |
written | otherwise | creates a File in Present; emits File |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Events
| event | fields | emitted by |
|---|---|---|
FileCopied | file_ FileId, source_ FileId, lease_ LeaseId, to Path, at timestamp | Copy |
FileDeleted | file_ FileId, lease_ LeaseId, at timestamp | Delete |
FileEdited | file_ FileId, lease_ LeaseId, before Content, at timestamp | Edit |
FileMoved | file_ FileId, lease_ LeaseId, from Path, to Path, at timestamp | Move |
FileWritten | file_ FileId, workspace_ WorkspaceId, lease_ LeaseId, path Path, content Content, at timestamp | Write |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Views
| view | rows | fields |
|---|---|---|
FilesFiles | each File | file_ FileId, workspace_ WorkspaceId, path Path, content Content, executable boolean, last_ LeaseId, state State |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Types
| type | is | values or fields |
|---|---|---|
AnchoredEditReplace the text anchor, which must occur exactly once in the file, with replacement. | a record | anchor Content, replacement Content |
DirectoryEntry | a record | path Path, kind EntryKind |
Edit | exactly one of | Anchor AnchoredEdit, Range RangeEdit, Whole Content |
EntryKind | one of | File, Directory |
FileId | an identifier or value | uuid |
RangeEditReplace the lines from first_line to last_line, both included, counted from 1. | a record | first_ integer, last_ integer, replacement Content |
SearchMatch | a record | path Path, line integer, excerpt string |
More columns: swipe horizontally, or focus the table and use the arrow keys.
KPIs
3 KPIs from the pack's catalogue, packs/files/kpis.yaml. A gate must be zero for a variant of an architecture to count.
Correctness
| KPI | unit | better | gate | status |
|---|---|---|---|---|
write_after_lease_endFile changes made under a lease that had already ended. How: FileWritten, FileEdited, FileCopied, FileMoved and FileDeleted events whose lease has a LeaseReleased or LeaseExpired before the change. The tools refuse these; any found is an implementation defect. Must be 0. | count | lower | gate | planned source: design |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Quality
| KPI | unit | better | gate | status |
|---|---|---|---|---|
file_churn_ratioEdits per file an agent changed in one run. How: FileEdited events divided by the distinct files written or edited, per lease. A high ratio is an agent editing the same file over and over. | ratio | lower | – | planned source: design |
stale_edit_shareShare of edits made against content that had changed since it was read. How: edit_file calls refused content-changed divided by all edit_file calls. Counted from the tool's answers; each refusal is an agent working from a stale read. | share | lower | – | planned source: design |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Settings
The settings a part of this block carries in an architecture document. agenticspec sim check refuses any other setting (setting_unknown) and a value outside its type (setting_invalid), and a part that lacks a setting marked required in the default column; the contract copies a setting into the ports it narrows. The last rows of each table are the settings every part takes. What no setting here types (a file, a path, an audience, the use of a model) goes into the part's notes, a map with free keys and values that the check takes as written and nothing reads.
A part files.toolset:
| setting | type | unit | default | contract | what |
|---|---|---|---|---|---|
count | integer of at least 1 | 1 | How many copies of the part run. | ||
per | part | One copy of the part for each copy of the named part. | |||
notes | notes | Free notes on the part, a map with keys and values of any kind: what no setting of its block types. The check takes any map; the simulator, the search and the contract never read it. |
More columns: swipe horizontally, or focus the table and use the arrow keys.