From 2ee026dda303058310dc431b4e798d73b0070d78 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 11 Nov 2026 22:53:47 -0500 Subject: [PATCH] docs: reduce always-on file and image skill instructions --- priv/python/albedo_plugins/files.py | 11 ++++++++++- priv/skills/imagegen/SKILL.md | 2 +- src/albedo/harness/extensions/files/extension.gleam | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/priv/python/albedo_plugins/files.py b/priv/python/albedo_plugins/files.py index f5923f320..9386abb34 100644 --- a/priv/python/albedo_plugins/files.py +++ b/priv/python/albedo_plugins/files.py @@ -271,7 +271,16 @@ class Files: """Original bytes of this session's uploaded image, ready for an image library. Index is zero-based. Without entry, use the latest user message with - images; otherwise entry is that message's transcript position. + images, looking past later text-only messages. Otherwise entry is that + message's transcript position. Unavailable uploads raise FilesError with + code image_unavailable; invalid arguments raise ValueError. + + Assign the bytes before opening them, for example: + data = await files.image() + picture = Image.open(io.BytesIO(data)) + + The host reads the upload, including for remote kernels. Do not search + the daemon database or infer a path in the daemon's home. """ if type(index) is not int or index < 0: raise ValueError("index must be a nonnegative integer") diff --git a/priv/skills/imagegen/SKILL.md b/priv/skills/imagegen/SKILL.md index a7a337246..a32baab84 100644 --- a/priv/skills/imagegen/SKILL.md +++ b/priv/skills/imagegen/SKILL.md @@ -1,6 +1,6 @@ --- name: imagegen -description: Generate or edit images with deliberate art direction, references, and visual review. Use for illustrations, photographs, concept art, game assets, textures, or image variants, especially when avoiding generic AI-generated aesthetics. Prefer editable SVG, diagrams, or code when exact structure matters more than a bitmap. +description: Generate or edit photos, illustrations, game assets, textures, and image variants with art direction, references, and visual review. Prefer SVG or code for exact text, data, or diagrams. license: Apache-2.0 compatibility: Requires Albedo's imagegen extension and an enabled image-generation driver; all calls run inside Python cells. --- diff --git a/src/albedo/harness/extensions/files/extension.gleam b/src/albedo/harness/extensions/files/extension.gleam index 9a15f2c33..bf2b1c3df 100644 --- a/src/albedo/harness/extensions/files/extension.gleam +++ b/src/albedo/harness/extensions/files/extension.gleam @@ -21,7 +21,7 @@ pub fn extension() -> extension.Extension { } const instructions = - "files.read(path, start_line=, end_line=, limit=) returns complete numbered lines; limit counts lines, and a separate max_chars= budget (default 16000 characters) stops very large windows and says where to resume, files.ls(path, pattern=) lists one directory, files.write(path, content) creates or replaces a whole file, and files.edit(path, old, new) replaces one exact unique string, reporting every occurrence with line ranges when it is not unique; retry it with line_hint=. files.edit(path, [(old, new), ...]) applies several replacements to one file in order, all or none: the first that misses or is not unique names its number, and nothing is written; use it instead of reading, replacing and writing a file yourself. These return immediately, and awaiting them also works. await files.find(pattern, path, glob=, context=N, literal=, case_sensitive=, max_results=50, hidden=, ignored=) searches contents under one path or a list of them (a regex unless literal=True) with N surrounding lines. A missing root raises, hidden and ignored files are skipped unless hidden=True / ignored=True, and an empty result reports the searched root, file count, what was skipped, and skipped files that would match. await files.paths(pattern) searches names. Both run a background search and must be awaited; await parallel(...) runs several searches at once. Prefer these over rg, grep, find, ls, cat, and sed through run(). Uploaded images are also available as bytes: data = await files.image(index=0, entry=None) reads an image from this session. Indices start at zero. By default it uses the latest user message that contains images, even after later text-only messages; entry= selects a user transcript position. FilesError reports unavailable uploads; invalid Python arguments raise ValueError. Assign the bytes to a variable and open them with an image library (for example Image.open(io.BytesIO(data))) to crop or inspect the original upload. Do not search the daemon database or assume a local daemon path; this call also reaches the host from a remote kernel." + "files.read(path, start_line=1, end_line=None, limit=None, max_chars=16000) returns numbered whole lines; limit counts lines, max_chars bounds characters, and a stopped read names where to resume. files.ls(path, pattern=) lists one directory. files.write(path, content) creates/replaces a file. files.edit(path, old, new, line_hint=None) replaces one unique match; ambiguity reports line ranges. files.edit(path, [(old,new), ...]) applies edits in order, all or none; prefer it to read/replace/write. await files.find(pattern, path, glob=, context=N, literal=False, case_sensitive=, max_results=50, hidden=False, ignored=False) searches contents by regex unless literal=True; path accepts one root or a list. Missing roots raise; empty results explain searched/skipped files. await files.paths(pattern) searches names. Both searches need await; use await parallel(...) for independent searches. Prefer these APIs over rg/grep/find/ls/cat/sed through run(). await files.image(index=0, entry=None) returns original uploaded bytes from the latest user message with images, or entry's transcript position; index is zero-based. FilesError reports unavailable uploads. Assign bytes before image-library use. This works remotely; do not read the daemon database or guess upload paths. Method docstrings give limits, errors and examples." fn image( context: host.Context, -- knotmirror 0.0.1