Qubasa 9851ac1572
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Update Flake Inputs / update-flake-inputs (push) Failing after 46s
Merge pull request 'collin/initial-setup' (#1) from collin/initial-setup into main
Reviewed-on: #1
2026-01-28 11:04:48 +00:00
2026-01-06 06:24:33 -05:00
2026-01-17 14:01:05 -05:00
2026-01-02 16:17:27 +00:00

clan-llm

Welcome to Clan's LLM repository. This repository contains Clan's experiments related to LLMs and how they can be used as an interface to managing your Clan.

Getting Started

Structure

The repository currently contains two main components:

  • Clan LLM Lib: The library components that power other tools
  • Clan CLI AI: A subcommand for Clan CLI that enables you conversationally modify your Clan via a TUI.

These components are located in pkgs which roughly follows the same structure as clan-core.

├── checks
│   └── llm                         # Container Tests
└── pkgs
    └── clan-llm
        ├── clan_cli                # Clan CLI Functionality
        │   └── ai                  # AI Subcommand
        └── clan_lib                # Clan LLM Library
            └── llm
                └── container_data  # Container Test Data

Setup

Supported Operating Systems

  • Linux
  • macOS

Getting Started with the Development Environment

Let's get your development environment up and running:

  1. Install Nix Package Manager:

    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
    
  2. Install direnv:

    • To automatically setup a devshell on entering the directory
    nix profile install nixpkgs#nix-direnv-flakes nixpkgs#direnv
    
  3. Add direnv to your shell:

    • Direnv needs to hook into your shell to work. You can do this by executing following command. The example below will setup direnv for zsh and bash
    echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc && echo 'eval "$(direnv hook bash)"' >> ~/.bashrc && eval "$SHELL"
    
  4. Allow the devshell

    • Run direnv allow to setup the necessary development environment to execute the clan command
  5. Configure Nix for Container Tests

    • Container tests require the uid-range system feature in the Nix sandbox. This feature allows Nix to allocate a range of UIDs for containers to use.

    • Add the following to your NixOS configuration:

    nix.settings.experimental-features = [ "auto-allocate-uids" "cgroups" ];
    nix.settings.auto-allocate-uids = true;
    nix.settings.system-features = [ "uid-range" ];
    
    • Or add to your /etc/nix/nix.conf:
    experimental-features = auto-allocate-uids cgroups
    auto-allocate-uids = true
    system-features = uid-range
    
  6. Create a Gitea Account

    • Register an account on https://git.clan.lol
    • Fork the clan-llm repository
    • Clone the repository and navigate to it
    • Add a new remote called upstream
    git remote add upstream gitea@git.clan.lol:clan/clan-llm.git
    
  7. Allow .envrc

    • When you enter the directory, you'll receive an error message like this:
    direnv: error .envrc is blocked. Run `direnv allow` to approve its content
    
    • Execute direnv allow to automatically execute the shell script .envrc when entering the directory.
  8. (Optional) Install Git Hooks

    • To syntax check your code you can run:
    nix fmt
    
    • To make this automatic install the git hooks
    ./scripts/pre-commit
    

Testing

Unit Tests

Run pytest to execute unit tests:

pytest

Flake Checks

The flake provides several checks to validate your changes:

Run All Checks

nix flake check

Individual Checks

  • LLM Container Test: Tests the LLM functionality in a NixOS container

    nix build .#checks.x86_64-linux.llm
    
  • Format Check: Validates code formatting with treefmt

    nix build .#checks.x86_64-linux.treefmt
    

Formatting

To format your code:

nix fmt
S
Description
No description provided
Readme MIT 1.9 MiB
Languages
Python 94%
Nix 6%