> For the complete documentation index, see [llms.txt](https://primer.interlisp.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://primer.interlisp.org/saving-your-work.md).

# Saving Your Work

Medley's File Manager subsystem (also known as the File Package) manages your code in memory and on disk. As we define and change functions, variables, and data structures, the File Manager keeps track of what we have stored in memory and what has been written to external storage. When we load a file in Medley, it parses all the text in the file as Lisp objects and data structures that are ready in memory for the system to use.  As you change your code and data, you can ask the File Manager to show your changes and store them on disk.

#### For saving and loading our work, essential functions and commands (to be typed in the Exec) are:&#x20;

1. `(FILES?)`: Displays the functions, variables, and so on we created or changed and asks for directions for each one: add it to an existing file, add it to a new file, or ignore it.  `(FILES?)` does not update the file on disk, but simply logs what should be saved. <br>

   <figure><img src="https://1366795813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG3fVTBmo1XNPYfBBw5Wd%2Fuploads%2FxIxuSoh0Vxw2K4jzkIkM%2FSAVE%20ADDER%20FILE.png?alt=media&amp;token=ae45d3ca-77d3-4685-9b30-977b8b7c3b3e" alt="" width="425"><figcaption></figcaption></figure>
2. `(MAKEFILE 'filename)`: Saves the changes made to a file by writing it to disk. You can now find the file in your current directory.<br>

   <figure><img src="https://1366795813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG3fVTBmo1XNPYfBBw5Wd%2Fuploads%2FjgYFpk8XipL5zGB0KeIW%2FMAKEFILE%20ADDER%20FUNCTION.png?alt=media&amp;token=fd952ec7-7e66-40d3-9975-3910319c4714" alt="" width="433"><figcaption></figcaption></figure>

   We can also call `MAKEFILES` to iterate the `MAKEFILE` operation over a list of files. `MAKEFILES` takes an optional list of files as arguments.  Calling it without arguments - `(MAKEFILES) -`  writes all changes to disk.
3. `(LOAD 'filename)`: Loads the file `filename` and its definitions.<br>

   <figure><img src="https://1366795813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG3fVTBmo1XNPYfBBw5Wd%2Fuploads%2F92y1tu67rIWHdN7jSO4l%2FLOAD%20ADDER%20FUNCTION.png?alt=media&amp;token=c6365668-cf85-43ea-8c3b-5a0be67321f2" alt="" width="406"><figcaption></figcaption></figure>
4. `FILELST` : A variable that contains all files currently loaded in the environment.<br>

   <figure><img src="https://1366795813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG3fVTBmo1XNPYfBBw5Wd%2Fuploads%2F8UflmG7u8Mlia7SlEIqV%2FFILELIST%20ADDER%20FUNCTION.png?alt=media&amp;token=e8ef6b1f-c40d-4e6e-9ca0-c91b002b8e83" alt="" width="407"><figcaption></figcaption></figure>
5. `filenameCOMS`: Gives a list of all definitions contained in the named file.  For instance, you can see all definitions associated with the file `ADDER-FUNCTION` on the variable `ADDER-FUNCTIONCOMS`.<br>

   <figure><img src="https://1366795813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG3fVTBmo1XNPYfBBw5Wd%2Fuploads%2FBgnsk58SeoqsZ0zBOl4p%2FFILENAMECOMS%20ADDER%20FUNCTION.png?alt=media&amp;token=4c63538f-79c4-4ab8-8fc7-6f4d585bbe98" alt="" width="407"><figcaption></figcaption></figure>

{% hint style="info" %}
You can save multiple Lisp objects to the same file. Try saving all our relevant variables and functions from the previous chapter *(Build Your First Interactive Program)* to a file! We will use and update this file moving forward.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://primer.interlisp.org/saving-your-work.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
