L
LLLOS.ai
Career
L
◆ AI Learning · Hard rule

What are the critical rules an AI model must follow when working with files, APIs, and sessions?

An AI model must always provide full file paths when creating or changing files. The AI model must test batch API calls with a small number first. The AI model must use `as_completed` for asynchronous operations. The AI model must write to temporary files before replacing original files. The AI model must confirm JSON format before writing data. The AI model must avoid `sleep` commands and use background processes for long tasks. The AI model must flag long sessions and update a memory file at the end of a session.

By Pawan Nayar · from the LLOS AI Learning record

The rule

An AI model must always provide full file paths when creating or changing files.

The AI model must test batch API calls with a small number first. The AI model must use `as_completed` for asynchronous operations. The AI model must write to temporary files before replacing original files. The AI model must confirm JSON format before writing data. The AI model must avoid `sleep` commands and use background processes for long tasks. The AI model must flag long sessions and update a memory file at the end of a session.

An AI model must state the full path every time it creates or changes a file. The AI model must list all full paths at the end of a conversation. This helps the user copy file information to other conversations. When using a batch API, the AI model must first test with a small number of items. For example, it should use `--test 5`. Then, the AI model can process more items. For asynchronous operations, the AI model must use `as_completed(tasks)`. The AI model must not use `for item: await fn(item)`. A semaphore does not create true parallelism. When writing to files, the AI model must never write directly to a production file. For example, it should not use `open(prod.json, 'w')`. Instead, the AI model must write to a temporary file, like `.tmp`. Then, the AI model must use `os.replace()` to move the temporary file. Before writing a script that creates data, the AI model must read the script that uses the data. This confirms the expected JSON shape. This prevents errors in data format. The AI model must not use `sleep` commands. Commands that take longer than five seconds must run in the background. The AI model should use `run_in_background:true`. Monitoring these tasks only requires `tail -3`. If a session is long, the AI model must tell the user proactively. The AI model should give the user a prompt to copy and paste. This prompt should list all Markdown files for the user to re-read. At the end of a session, the AI model must update the `MEMORY.md` file. It must add all new or changed file paths to the "Key File Paths" section.

A developer asks an AI model to create a new configuration file. The AI model creates the file but does not provide the full path. The developer then cannot easily find the file or share its location with a team member. This causes delays and confusion.

Words you'll need

Resolved from this lesson's own record — real definitions, not invented for this page.

API Interaction

Let software talk to software automatically

Resource Management

Deciding what computing power the AI actually needs

Robustness

How well AI performs under different conditions

Fault Tolerance

System keeps working even when parts break

Questions people ask

More from the same record, pulled by shared topic — not written new for this page.

How can an AI system reduce maintenance costs and prevent data errors over time?

A strong data architecture prevents errors. It ensures that data always matches its expected format.

What files should an AI model read at the start of every session?

An AI model must always read a specific set of files. These files include 'mistakes_and_lessons.md'.

How can a developer prevent an AI model from truncating its output when creating large structured data?

A developer must estimate the token count of the AI model's output before making an API call. If the estimated output is more than 6000 tokens, the developer should split the request.

Why should an AI model never delete content a user paid to create?

A user spends money, subscription time, or personal effort to build content. Deleting this content is not acceptable.

What to remember

An AI model must always provide full file paths when creating or changing files. The AI model must test batch API calls with a small number first. The AI model must use `as_completed` for asynchronous operations. The AI model must write to temporary files before replacing original files. The AI model must confirm JSON format before writing data. The AI model must avoid `sleep` commands and use background processes for long tasks. The AI model must flag long sessions and update a memory file at the end of a session.