Skip to main content

Better Categorizer and Timewarrior Companion

Problem: ActivityWatch collects great data, but it's hard to get useful insights from it.

Solution: Rule-based categorization that transforms raw ActivityWatch events into meaningful tags with multiple output options.

Currently this script exports data from ActivityWatch into TimeWarrior, but I'm planning to let this be a general categorization/tagging tool with possibility to store things in different backends, possibly including to work as a watcher and reexport data back into ActivityWatch.

What it does

  • Categorizes ActivityWatch events using configurable rules (browser URLs, editor files, app names, tmux sessions)
  • Exports categorized activity to TimeWarrior for time tracking
  • Report and analyze commands to aid the user into tweaking the rules and configuration and reexporting the data.

Installation

Let me know if you try it or start using it. Following the SemVer standard, I'm free to break backward compatibility in the 0.x-series - and if I believe I'm the only user, I will most likely do that without any notice.

Installation from PyPI

pip install aw-export-timewarrior

Installation from Source

git clone https://github.com/tobixen/aw-export-timewarrior
cd aw-export-timewarrior
make install

Running as a Systemd Service

For continuous sync mode, you can run as a systemd user service:

make enable-service    # Install and start the service

Check status and logs:

systemctl --user status aw-export-timewarrior
journalctl --user -u aw-export-timewarrior -f

Requirements

  • Python - It's currently only tested with 3.13. If you want to use it with other versions, let me know.
  • ActivityWatch with aw-watcher-window running
  • TimeWarrior installed

Optional Watchers

For richer tag extraction, install additional watchers:

Support for other watchers may be considered, reach out by email or add an issue or pull request for it.

Quick Start

# Continuous sync mode
aw-export-timewarrior sync

# Compare ActivityWatch data with TimeWarrior (dry-run)
aw-export-timewarrior diff --day yesterday

# Apply suggested changes
aw-export-timewarrior diff --day yesterday --apply

# Gain insight into events and rules
aw-export-timewarrior report --from '2 hours ago' --show-rule
aw-export-timewarrior analyze --day yesterday --limit 30

Configuration

Configuration is stored in ~/.config/activitywatch/aw-export-timewarrior/aw-export-timewarrior.toml.

Rule Types

  • Browser rules (rules.browser.*): Match URLs with url_regexp
  • Editor rules (rules.editor.*): Match by project name or path_regexp
  • App rules (rules.app.*): Match by app_names and title_regexp
  • Tmux rules (rules.tmux.*): Match by session, window, command, path
  • Tag rules (tags.*): Transform tags with add, remove, replace operations
  • Exclusive rules (exclusive.*): Prevent conflicting tags from combining

Example Configuration

[rules.browser.github]
url_regexp = "github\\.com"
tags = ["coding", "github"]

[rules.editor.myproject]
path_regexp = "/home/user/projects/myproject"
tags = ["myproject", "coding"]

[rules.app.slack]
app_names = ["slack", "Slack"]
tags = ["communication", "slack"]

[tags.coding-is-work]
source_tags = ["coding"]
add = ["4WORK"]

[exclusive.afk]
tags = ["afk", "not-afk"]

Reusable Lists

A [lists] section defines named lists that can be referenced as @name elsewhere in the config. In list fields (tags, app_names, source_tags, etc.) the reference is replaced by the list items inline. In regexp fields (url_regexp, title_regexp, path_regexp, ...) it expands to a non-capturing alternation (?:item1|item2|...); items are not regex-escaped, so they may themselves be regexp fragments. Lists may reference other lists.

[lists]
customers = ["acme", "emca"]

[rules.editor.customer-work]
path_regexp = "^/home/user/(@customers)/"
tags = ["4WORK", "$1"]

[app_groups] is an older alias for the same mechanism.

Commands

Command Description
sync Continuous sync from ActivityWatch to TimeWarrior
diff Compare and generate correction commands
report Show activity report with tags
analyze Analyze events without exporting
timeline Show side-by-side ActivityWatch vs TimeWarrior
validate Validate configuration file

Use --help with any command for detailed options.

Development

make install-dev      # Install with dev dependencies
make test             # Run tests
make lint             # Run ruff check
make format           # Run ruff format
make clean            # Remove build artifacts
make help             # Show all available targets

Documentation

Background

This tool bridges ActivityWatch (automatic activity tracking) and TimeWarrior (manual time tracking). See the blog posts for rationale:

License

MIT

Metadata

Release files for aw-export-timewarrior 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aw-export-timewarrior 1.0.1
File Size Uploaded
aw_export_timewarrior-1.0.1.tar.gz 102.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aw-export-timewarrior 1.0.1
File Interpreter ABI Platform
aw_export_timewarrior-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 212.2 kB

Release files / aw_export_timewarrior-1.0.1.tar.gz

Download URL aw_export_timewarrior-1.0.1.tar.gz
Size 102.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fd153c968ca6e9ec7d01921eb0774f3e6d96f869f08e1785210b70d8ff5244fe
BLAKE2b-256 checksum
How to use checksums
0dd6ab3625d92b9a711f3b3e56473f313b6a8be2ebe5561c66374eed2cead3c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

Release files / aw_export_timewarrior-1.0.1-py3-none-any.whl

Download URL aw_export_timewarrior-1.0.1-py3-none-any.whl
Size 109.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9715b8a4bf43f4f3ad049763497c3f597b15fddc109f7c8687eca74e17dbd478
BLAKE2b-256 checksum
How to use checksums
45e154672df29e15d890a2a3aeb30bbdae782692be16fcf7d0a7bf19f37f4015
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.6.5

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page