> For the complete documentation index, see [llms.txt](https://docs.logos.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.logos.co/core/build-modules/start-a-logos-module-from-the-cli.md).

# Start a Logos module from the CLI

#### Explore how to load and call a Logos module from the command line using `logoscore`.

This guide covers how to build and install a Logos module, start the `logoscore` daemon, and call module methods from the command line. It is intended for users who want to run an existing module, or developers who have already built a module binary and want to run it locally for testing or development. By the end you will have a running `logoscore` instance that loads [`accounts_module`](https://github.com/logos-co/logos-accounts-module) as an example module and returns results for mnemonic generation and relative strength.

**Before you start**, make sure you have the following:

* **Nix** with flakes enabled. Install from [nixos.org](https://nixos.org/download.html), then enable flakes:

  ```bash
  mkdir -p ~/.config/nix
  echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
  ```

  Verify: `nix flake --help >/dev/null 2>&1 && echo "Flakes enabled"`
* Git
* Linux or macOS

## What to expect

* You can load `accounts_module` into a running `logoscore` daemon and call its methods.
* You can generate a BIP-39 mnemonic phrase and measure its entropy strength with no prior setup.
* You have a working local `modules` directory that `logoscore` can scan for future modules.

## Build the required tools

Both `logoscore` and the Logos package manager are built from their respective Nix flakes before running the module.

1. Build `logoscore`:

   ```bash
   nix build 'github:logos-co/logos-logoscore-cli/tutorial-v3' --out-link ./logos
   ```

   The build produces `logos/bin/logoscore` plus bundled runtime libraries and a `logos/modules/` directory containing the built-in `capability_module` (required for the auth handshake when loading modules).
2. Build the Logos package manager CLI:

   ```bash
   nix build 'github:logos-co/logos-package-manager/tutorial-v3#cli' --out-link ./pm
   ```

   The executable is at `./pm/bin/lgpm`.

## Install the module

`logoscore` expects each module in its own subdirectory containing a `manifest.json`. The `lgpm` package manager handles this layout automatically when given an LGX package.

1. Clone the `logos-accounts-module` repository and build the LGX package:

   ```bash
   git clone https://github.com/logos-co/logos-accounts-module.git
   cd logos-accounts-module

   nix build '.#lgx'

   cd ..
   ```
2. Create the `modules` directory and copy the pre-loaded logos modules to it:

   ```bash
   mkdir -p modules
   cp -RL ./logos/modules/. ./modules/
   ```
3. Install the LGX package into the `modules` directory:

   ```bash
   ./pm/bin/lgpm --modules-dir ./modules install --file ./logos-accounts-module/result/*.lgx
   ```

   After installation, the directory structure looks like this:

   ```
   modules/accounts_module/
   ├── accounts_module_plugin.dylib   # (or .so on Linux)
   ├── manifest.json                  # Auto-generated by lgx
   └── variant                        # Platform variant identifier
   ```
4. Confirm the module was installed correctly:

   ```bash
   ./pm/bin/lgpm --modules-dir ./modules list
   ```

## Call module methods

With the module installed, start the [`logoscore`](https://github.com/logos-co/logos-logoscore-cli) daemon, load the module, and call its methods.

1. Start the daemon in the background, pointing it at the modules directory, and wait to initialise:

   ```bash
   ./logos/bin/logoscore -D -m ./modules &
   sleep 3
   ```
2. Check the status of `logoscore`:

   ```bash
   ./logos/bin/logoscore status
   ```
3. Load the module and confirm that it was loaded:

   ```bash
   ./logos/bin/logoscore load-module accounts_module

   ./logos/bin/logoscore list-modules
   ```
4. Generate a random BIP-39 mnemonic phrase with 12 words:

   ```bash
   ./logos/bin/logoscore call accounts_module createRandomMnemonic 12
   ```
5. Map a mnemonic word count to its entropy strength in bits — for example, 12 words is 128 bits.

   ```bash
   ./logos/bin/logoscore call accounts_module lengthToEntropyStrength 12
   ```
6. Inspect all available methods in `accounts_module` with `module_info`:

   ```bash
   ./logos/bin/logoscore module-info accounts_module
   ```
7. Stop the daemon:

   ```bash
   ./logos/bin/logoscore stop
   sleep 2
   ```

   For inline (legacy) mode and other `logoscore` options, see the [Developer Guide — Running with logoscore](https://github.com/logos-co/logos-tutorial/blob/tutorial-v3/logos-developer-guide.md#61-running-with-logoscore).

## Troubleshooting `logoscore` module startup

### The modules directory is not found

Confirm the module subdirectory exists and contains a `manifest.json` file. Installing the package again with the correct `--modules-dir` path resolves this in most cases.

### The platform key in `manifest.json` does not match

`logoscore` matches the `main` object in `manifest.json` against your OS and architecture (for example, `linux-aarch64` or `darwin-arm64`). Rebuild the LGX package on the target platform and reinstall.

### The daemon does not respond after `sleep 3`

Increase the sleep duration if your machine is slow to initialise, or check for port conflicts by inspecting the daemon's stderr output.


---

# 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://docs.logos.co/core/build-modules/start-a-logos-module-from-the-cli.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.
