> For the complete documentation index, see [llms.txt](https://no0dles.gitbook.io/hammerkit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://no0dles.gitbook.io/hammerkit/task/watching.md).

# Watching

## Watching

Tasks with source folders and files can be watched and, on change, get restarted. This can be used for example to run api servers that restart when the server code changes.

```yaml
tasks:
  api:
    src:
      - src
    cmds:
      - node -r ts-node/register src/index.ts
```

```bash
hammerkit api --watch
```

In watch mode hammerkit watches the `src` of every task in the run. When a file changes it re-runs the affected task — and, because it knows the dependency graph, any tasks downstream of it — reusing cached results for everything unchanged. A short debounce coalesces bursts of saves into a single restart. Combine `--watch` with services (via `needs`, or [`hammerkit up --watch`](/hammerkit/cli/up.md)) to keep a database running while your api restarts on every edit; the [development workflow guide](/hammerkit/local-vs-container/development-workflow.md) puts these together.

## Continuous tasks

Task may be continuous and watch for their file changes themselve. For example the angular/cli will watch for file changes and restart the build incremental and therefore performs faster than hammerkit can do with restarting the task. It's recommended to mark such tasks with `continuous: true`. Hammerkit will then not watch for files change in the source directory of such tasks if started in watch mode.

```yaml
tasks:
  serve:
    image: node:24
    continuous: true
    src: 
      - src
      - angular.json
    cmds:
      - ng serve
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://no0dles.gitbook.io/hammerkit/task/watching.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
