# Package an agent

> An agent chart end to end: a mind and a channel it needs, the agent and what it may do, a daily schedule, the proofs and a repair.

This guide walks through a real agent chart: a morning brief that writes to its owner on Telegram every day at the hour they choose. The whole folder is in the repository's examples.

```text
morning-brief/
  chart.json                              what the chart is and what it needs (the schedule too)
  README.md                               what the owner reads first
  agents/brief/SOUL.md                    who the agent is
  agents/brief/IDENTITY.md                its name and voice
  agents/brief/AGENTS.md                  what it does
  automations/morning-brief.message.md    what it is asked each morning
```

## 1. Start from the skeleton

```sh [Terminal]
alta chart new morning-brief --kind agent
```

## 2. What it needs

A mind to think with, and a channel that can write first (`push`). You do not name Claude or Telegram: the owner's own choices are reused, and the game adds the accounts to connect. See [Needs](https://docs.altasystem.ai/charts/concepts/needs).

```json [chart.json: needs]
{ "mind": {}, "channel": { "features": ["push"] } }
```

## 3. The choices

The owner picks an hour. A value is for what is the chart's own, never to pick a provider.

```json [chart.json: values]
{
  "hour": {
    "kind": "text",
    "label": { "en": "At what time?", "fr": "À quelle heure ?" },
    "default": "07:30",
    "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
  }
}
```

## 4. The agent and what it may do

```json [chart.json: agents]
[
  {
    "id": "brief",
    "name": { "en": "Brief", "fr": "Brief" },
    "files": ["SOUL.md", "IDENTITY.md", "AGENTS.md"],
    "model": "need:mind",
    "channel": "need:channel",
    "permissions": {
      "tools": {
        "allow": ["message", "gbrain__recall"],
        "deny": ["write", "edit", "exec", "browser"]
      },
      "channels": ["need:channel"]
    },
    "wake": ["morning-brief"]
  }
]
```

`"need:mind"` gives the agent the mind bound to that need, `"need:channel"` its channel. Its tools are listed: everything else is denied.

## 5. The schedule

```json [chart.json: automations]
[
  {
    "key": "morning-brief",
    "title": { "en": "Morning brief", "fr": "Point du matin" },
    "agent": "brief",
    "schedule": { "daily": "$hour" },
    "message": "automations/morning-brief.message.md",
    "spends": "model"
  }
]
```

An automation is created off. A part turns it on, after the owner's yes.

## 6. The parts, in order

```json [chart.json: parts]
[
  {
    "id": "agent",
    "do": "agent.create",
    "args": { "agent": "brief" },
    "requires": ["need:mind", "need:channel"],
    "undo": "archive",
    "proof": [{ "type": "agent", "id": "brief" }]
  },
  {
    "id": "schedule",
    "do": "automation.enable",
    "args": { "key": "morning-brief" },
    "requires": ["agent"],
    "undo": "auto",
    "proof": [
      {
        "type": "automation",
        "key": "morning-brief",
        "enabled": true
      }
    ]
  }
]
```

## 7. The proofs and a repair

`ready` says the channel works (`{ "type": "need", "id": "channel" }`, the proof of whichever provider is bound) and the schedule is on; `alive` checks every hour that the brief ran in the last 26 hours, and offers a repair. See [let the owner allow a repair](https://docs.altasystem.ai/charts/guides/repairs).

```json [chart.json: proofs]
{
  "installed": [{ "type": "agent", "id": "brief" }],
  "ready": [
    { "type": "need", "id": "channel" },
    { "type": "automation", "key": "morning-brief", "enabled": true }
  ],
  "alive": [
    {
      "id": "ran",
      "check": {
        "type": "automation",
        "key": "morning-brief",
        "ranWithinHours": 26
      },
      "every": "1h",
      "repair": ["rerun"]
    }
  ]
}
```

## 8. Lint, look, install

```sh [Terminal]
alta lint morning-brief
alta template morning-brief --values values.json --bind mind=local
alta install morning-brief --values values.json
```

`values.json` holds the owner's answers, for example `{ "hour": "06:45" }`; `--bind` picks a provider for a need, as the owner's "change" does. `alta install` prints the plan; add `--yes` to run it.

**Next:**

- [Publish a chart](https://docs.altasystem.ai/marketplace/publish)
- [Anatomy of a chart](https://docs.altasystem.ai/charts/concepts/anatomy)
