cognition.guide.sections¶
Access to the packaged agent guide (AGENTS.md), one section at a time
Classes¶
One heading of the guide and the text under it |
Functions¶
File path of |
|
|
Splits a markdown guide into sections, in document order. |
|
Finds a section by exact heading match, ignoring backticks |
Module Contents¶
- class cognition.guide.sections.GuideSection¶
One heading of the guide and the text under it
- level: int¶
Heading level (1 for
#, 2 for##, …)
- heading: str¶
Heading exactly as written (may contain backticks)
- text: str¶
The heading line through the end of the section, including all subsections (i.e., until the next heading at the same or a higher level)
- property name: str¶
- Returns:
heading without backticks; what to pass to
guide_section()(safe to quote in a shell)- Return type:
str
- cognition.guide.sections.guide_file()¶
File path of
AGENTS.md- Returns:
the guide shipped inside the installed
cognitionpackage- Return type:
importlib.resources.abc.Traversable
- cognition.guide.sections.guide_sections(text=None)¶
Splits a markdown guide into sections, in document order. Lines inside fenced code blocks are never headings.
- Parameters:
text (str | None) – markdown to split (
Nonefor the packaged guide)- Returns:
one section per heading
- Return type:
list[GuideSection]
- cognition.guide.sections.guide_section(name, text=None)¶
Finds a section by exact heading match, ignoring backticks (see
GuideSection.name)- Parameters:
name (str) – heading to find, e.g.
"Gotchas"text (str | None) – markdown to search (
Nonefor the packaged guide)
- Returns:
the matching section
- Raises:
KeyError – no heading matches (the message lists all names)
- Return type: