Framework for R

AI

ai_regenerate_context()

Regenerate Dynamic Sections in AI Context File

Updates only the sections marked with <!-- @framework:regenerate --> in an existing AI context file, preserving user customizations in unmarked sections.

Usage

ai_regenerate_context(project_path = ".", sections = NULL, ai_file = NULL)

Arguments

Name Description
project_path

Path to the project directory

sections

Which sections to regenerate. NULL = all regeneratable sections. Options: "environment", "packages", "data", "functions"

ai_file

Name of the AI context file (default: from settings or "CLAUDE.md")

Value

Invisible TRUE on success

Examples

if (file.exists("CLAUDE.md")) {
  # Regenerate all dynamic sections
  ai_regenerate_context()
  # Regenerate only packages section
  ai_regenerate_context(sections = "packages")
}