knowledge / agent-workflow /workflow.md
mkschreder123's picture
Upload folder using huggingface_hub
c3a45c0 verified
|
Raw History Blame Contribute Delete
4.4 kB
---
# SPDX-License-Identifier: CC-BY-4.0
# Copyright (c) 2026 Martin Schröder <info@swedishembedded.com>
title: How to work any task with tools
tiers: rule 1, procedure 2, example 3, mistakes 2
---
# How to work any task with tools
For every task, whatever the subject.
<!-- tier: 1 -->
## Rule
**The task's own files and stated rules always win over this page; use this page only for what
the task leaves open.**
1. **Only a real tool call acts.** Text that looks like a tool call inside your reasoning runs
nothing. If no tool result came back, you did not call a tool: call it now.
2. **The request is the specification.** It fixes the deliverable: file name, place, field names,
value formats, and what you must not do. The task's files are the only source of rules.
3. **Read every input the request names before you conclude anything.**
4. **Compute with a script, never in your head.** Dates, sums, percentages and rounding go through
a short script. If your head and a correct script disagree, the script is right.
5. **Never send the same failing call twice.** Change what the error message points at.
6. **A command that changes state runs once, alone, and is then checked.**
7. **Never search for the answer** in the repository history, hidden directories or elsewhere on
the machine. It voids the result and the answer is not there. Never clean or reset the
repository: that deletes your own answer.
8. **The deliverable must exist, in the right place and shape.** Write a first version early.
9. **Check once, then stop.**
<!-- tier: 2 -->
## Procedure
1. Read the whole request. Note the goal, the deliverable, the inputs, and every "do not".
2. List the working directory once. Stay in it: relative paths in the request start there, and
"repository root" means this directory.
3. Read every input file the request names, reference tables and policies included. If you read
several files in one turn, match each result to its file by its content; results can come back
in another order.
4. If the request states a rule or method, apply it as written. Use a knowledge page only for
what the request leaves open.
5. Put the calculation in a script file, run it, and read its output.
6. Write the deliverable exactly as the request shapes it. Use the tool's exact parameter names;
when an error names the right parameter, use it in the next call.
7. Re-read the request. Check the deliverable against it: exists, parses, same keys, allowed
labels, numbers from the script, inputs untouched.
8. Delete your helper files. Say in one or two sentences what you delivered. End.
Budget: if half of your steps are gone and nothing is written, write your best answer now and
improve it afterwards.
You are in a loop when the last two calls or the last two errors were the same, or when you
re-check an answer that already passed. Then: read the error word by word and fix exactly that;
or switch to the simplest method (write a file, run it); or, if the answer is written and
checked, end the task.
<!-- tier: 3 -->
## Worked example
Illustration only, with invented data. Your task's data differs: take no fact, count or
expected result from this example.
Invented task: "Report the total of `items.csv` in `result.json` as `{"total": 0.0}`. Do not
change the input."
1. Read the request: deliverable `result.json` in the working directory, one key `total`, a
number.
2. List the directory: `items.csv` is there. Read it: four rows with an `amount` column.
3. Write `sum.py`: read the CSV, add the amounts as exact decimals, print the rows and the total,
write the JSON file with a JSON library.
4. Run `python3 sum.py`. Output: 4 rows, total 61.40.
5. Read `result.json` back: `{"total": 61.4}`. One key, a number, parses.
6. Delete `sum.py`. Final message: "Wrote result.json with the total of the four rows." End.
<!-- tier: 2 -->
## Common mistakes
- Arguing at length between a page and the task. The task wins; decide and move on.
- Writing the tool call as text in the reasoning, so nothing runs and the task ends empty.
- Writing the answer in another directory than the one the task started in.
- Resending a broken command unchanged, three, five, ten times.
- Putting a long program inside one quoted command line; the quoting breaks. Use a script file.
- Doing sums or date counts mentally and being off by a digit, a day or a month.