Alphakdeps.io is experimental and evolving — the registry and packages may change or reset.
Toolkdeps asset

kdeps-tools-write_file

v2.0.0

Write or overwrite a text file on the local filesystem. Creates a new file if it does not exist; overwrites existing files entirely. Use for creating or updating configuration files, source code, scripts, or any text-based file. Takes an absolute path.

set tools / shelf tools

LLM context: ~168 tokens when loaded (prompt or tool definition)

Where it runs

Part of the tools set, used in workflow and agent mode. What the model is told about each built-in tool: its description, usage notes and parameters. kdeps runs the tool itself.

  1. the agent loop builds the request
  2. the tool definitions are sent to the modeltools/write_file
  3. the model calls a tool
  4. kdeps runs it
  5. the result goes back to the model

Loaded by: kdeps (agent loop), /update, /settings, kdeps run, kdeps install, kdeps list, kdeps uninstall, kdeps update

In the code: kdeps (agent loop)agent.RegisterBuiltinToolsagent.definedAs

Install

A kdeps asset: installed with the first-run profile that includes its set, or the first time a command needs it, and updated without a new release.

kdeps install tools/write_file

Pin a version with kdeps install tools/write_file@<version>.

Contents

Write or overwrite a text file on the local filesystem. Creates a new file if it does not exist; overwrites existing files entirely. Use for creating or updating configuration files, source code, scripts, or any text-based file. Takes an absolute path.

category
file
outputFormat
confirmation message with bytes written
seeAlso
edit_file, read_file
ParameterTypeDescription
content *stringText content to write to the file
file_path *stringAbsolute path to the file to write

Python script (declared in YAML, no Go code)

import json, os, sys

a = json.loads(sys.argv[1])
path = (a.get("file_path") or "").strip()
if not path:
    sys.exit("write_file: file_path is required")
path = os.path.abspath(path)
data = (a.get("content") or "").encode("utf-8")
# max_bytes comes from the file-read-limit event in an agent session.
cap = int(a.get("max_bytes") or 0) or 1048576
if len(data) > cap:
    sys.exit("write_file: content is %d bytes (max %d)" % (len(data), cap))
if os.path.isdir(path):
    sys.exit("write_file: %s is a directory" % path)
err = None
for _ in range(2):  # written, read back, and written once more on a mismatch
    try:
        fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | getattr(os, "O_BINARY", 0), 0o600)
        with os.fdopen(fd, "wb") as f:
            f.write(data)
        with open(path, "rb") as f:
            got = f.read()
    except OSError as e:
        err = "write_file: %s: %s" % (path, e.strerror or e)
        continue
    if got == data:
        print("Wrote %d bytes to %s" % (len(data), path))
        sys.exit(0)
    err = "write_file: verify %s: wrote %d bytes but read back %d bytes" % (path, len(data), len(got))
sys.exit(err)

Paths kept in the workspace: file_path

aliases:
  - write
  - create_file
  - save_file
  - write_to_file
constraints: overwrites entire file — use edit_file for targeted changes;
  relative paths resolve against the working directory; the parent directory
  must exist

Versions

VersionPublishedStatus
2.0.010/24/2026active
1.1.010/17/2026active
1.0.010/11/2026active

Details

Author
kdeps
License
Apache-2.0
Latest Version
2.0.0
Published
10/11/2026

Tags

kdepstool