NAME

Langertha::Raider::Context::Layout - Internal decision which project layout raider reads

VERSION

version 0.504

SYNOPSIS

# Internal to Langertha-Raider -- no API promise.
my $layout = Langertha::Raider::Context::Layout->new(
  root          => $root,
  config_claude => $config->{claude},   # undef when not set
  force_claude  => $opt{claude},
  bare          => $opt{bare},
);
say $layout->mode.' ('.$layout->reason.')';     # claude (CLAUDE.md in root)
if ($layout->claude_layout) {
  my @dirs = $layout->walk_dirs;                 # repo top .. root
  my $dir  = $layout->project_dir;               # where .claude/ lives
}

DESCRIPTION

Internal module. Its interface may change without notice.

The layout-mode rule of ADR 0019 §1 as a pure function of the filesystem and a few inputs. Raider decides once per application, from "root", which layout it reads:

  • bare -- "bare" is set (--bare, ADR 0014): no layout at all.

  • native -- "root" is the home directory (the assistant home, ADR 0002), whatever is there.

  • raider -- .raider/ in "root" holding a project file: config.yml, instructions.md, or one of the directories skills/, agents/, packs/ (what raider writes there itself -- sessions/, lib/, .gitignore -- does not count, nor does raiders/, which nothing reads since ADR 0020); or a legacy .raider.yml / .raider.md (ADR 0011).

  • claude -- no raider files, but CLAUDE.md, CLAUDE.local.md or a .claude/ directory in "root" or in a directory of "walk_dirs". The home's own .claude/ ("claude_home" and <home>/.claude) never counts as a marker.

  • native -- neither.

"claude_layout" then says whether the Claude layout (memory, settings, Claude skill roots) is read. Paths are compared by their real path where the filesystem has one, so a symlinked temp directory compares equal to its target. Every directory this module returns is such a real path.

root

The project directory. Required.

home

The user's home directory. Defaults to "home_dir" in Langertha::Raider::Home; may be undef when no home is known.

claude_home

The Claude Code configuration directory: $ENV{CLAUDE_CONFIG_DIR} when set and not empty, else <home>/.claude. undef when neither is known.

config_claude

The effective claude: value of the raider config: true, false, or undef when the config does not set it. Taken by truth, so a YAML or JSON boolean object works as well.

force_claude

True for --claude: the Claude layout is read in every mode but bare.

bare

True for --bare: mode bare, no layout is read.

mode

my $mode = $layout->mode;   # bare | raider | claude | native

The layout mode, decided once per object (see "DESCRIPTION").

reason

my $why = $layout->reason;

What decided "mode", for config explain: --bare, root is the home directory, .raider/config.yml in root (or another project file in .raider/, see "DESCRIPTION"), .raider.yml in root, .raider.md in root, CLAUDE.md in root (or CLAUDE.local.md, .claude/; an ancestor of the walk is named by its absolute path, as in CLAUDE.md in /abs/dir), or no raider or Claude files.

claude_layout

if ($layout->claude_layout) { ... }

True when the Claude layout (memory, settings, Claude skill roots) is read: always in mode claude; in mode raider only with a true "config_claude"; never in mode native; in every mode but bare when "force_claude" is set; never in mode bare.

claude_layout_reason

Why "claude_layout" is on or off: Claude mode, --claude, claude: true in config, off: --bare, off: raider project without claude: true, or off: followed by the "reason" of mode native.

repo_top

my $top = $layout->repo_top;   # Path::Tiny or undef

The nearest directory from "root" upward ("root" included) that holds a .git file or directory, or undef outside a repository.

walk_dirs

my @dirs = $layout->walk_dirs;   # Path::Tiny, top down, last is root

The directories of the memory walk (ADR 0019 §2), top down and ending at "root": from "repo_top" when there is one, else from "home" (the home included) when "root" is below it, else only "root".

project_dir

my $dir = $layout->project_dir;   # Path::Tiny

The directory whose .claude/ holds the project settings and skills: the nearest directory from "root" upward along "walk_dirs" with a .claude/ directory (not the home's own) or a CLAUDE.md; "root" when there is none.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/langertha-raider/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

https://raudssus.de/