/**
* Project context loader — AGENTS.md (or its fallbacks) plus resolved file
* references. The TypeScript port of the Rust reference
* `smooth-operator-core::context` (pearl th-5002c4).
*
* Smooth previously only read AGENTS.md. Many projects don't have one but DO
* have CLAUDE.md or a SMOOTH.md or .smooth/CONTEXT.md. User-level facts also
* belong in the prompt, so we walk a preference order and STACK user-level +
* project-level context.
*
* Preference order (first hit per layer; layers stack):
*
* - USER layer (read once, prepended):
* `~/.smooth/CONTEXT.md` → `~/.smooth/AGENTS.md` → `~/.smooth/CLAUDE.md`
*
* - PROJECT layer (walk up from `workingDir`, first hit wins):
* `
/.smooth/CONTEXT.md` → `/SMOOTH.md` → `/AGENTS.md` → `/CLAUDE.md`
*
* AGENTS.md / SMOOTH.md can carry file references in a `## File References`
* section:
*
* ```markdown
* ## File References
* - [CLAUDE.md](CLAUDE.md) — full file
* - [Section name](CLAUDE.md#6-pearl-tracking) — specific section
* ```
*
* Those are resolved against the file's directory and appended inline. The
* combined string is what the host injects into the agent's system prompt —
* like the Rust reference, this is a standalone loader, NOT a hook inside the
* agent loop.
*/
/** A parsed file reference from the `## File References` section. */
export interface FileRef {
/** Display label from the markdown link text. */
label: string;
/** Relative file path (without fragment). */
path: string;
/** Optional `#fragment` pointing to a heading. */
fragment?: string;
/** Optional description after the ` — `. */
description?: string;
}
/**
* Load the combined project + user context, user-level prepended, with file
* references in any AGENTS.md / SMOOTH.md resolved inline.
*
* `undefined` only when NEITHER layer found anything — so a workspace with a
* bare CLAUDE.md and no user-level file still loads context.
*/
export declare function loadProjectContext(workingDir: string): string | undefined;
/**
* Walk up from `startDir` looking for a project context file. Preference order
* at each level: `.smooth/CONTEXT.md` → `SMOOTH.md` → `AGENTS.md` →
* `CLAUDE.md`. First hit wins per directory, then keep walking up.
*/
export declare function findProjectContextFile(startDir: string): string | undefined;
/**
* Parse the `## File References` section out of AGENTS.md content. Expects
* markdown list items like `- [Label](path.md#fragment) — description`.
*/
export declare function parseFileReferences(content: string): FileRef[];
/** Parse a single markdown list-item link line. */
export declare function parseLinkLine(line: string): FileRef | undefined;
/**
* Extract a markdown section by heading fragment. The fragment is matched
* against GitHub-style heading anchors; the section runs until the next
* heading at the same or a higher level.
*/
export declare function extractSection(content: string, fragment: string): string;
/** Convert heading text to a GitHub-style anchor. */
export declare function headingToAnchor(text: string): string;
//# sourceMappingURL=context.d.ts.map