Docs target current release v0.7.0.v0.7.1 is under review

Filesystem tools

opentine.tools.fs provides read, write, edit, and ls. With no explicit policy, paths are rooted at the current working directory and writes are allowed within that root.

filesystem.py
1from opentine.tools.fs import edit, ls, read, write
2
3content = read("src/main.py")
4listing = ls("src")
5write("output/report.md", "# Report\n")
6edit("output/report.md", "Report", "Verified report")

Operations

  • read returns UTF-8 text and enforces the file-size cap.
  • write creates parent directories and replaces content.
  • edit replaces the first match.
  • ls returns sorted entries prefixed with d or f .

Explicit policy

Use FilesystemPolicy to separate readable roots from writable roots, deny symlinks, and cap file size.

filesystem_policy.py
1from opentine.policies import FilesystemPolicy
2from opentine.tools.fs import read, write
3
4policy = FilesystemPolicy(
5    roots=("/workspace/project",),
6    write_roots=("/workspace/project/output",),
7    deny_symlinks=True,
8    max_file_bytes=250_000,
9)
10
11source = read("src/main.py", policy=policy)
12write("report.md", source, policy=policy)

Passing sandbox=None does not disable rooting; it uses the current working directory. There is no unscoped filesystem mode in these helpers, and special files are rejected rather than read as ordinary content.