Class: Woods::Formatting::ClaudeAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/woods/formatting/claude_adapter.rb

Overview

Formats assembled context as XML for Claude models.

Produces structured XML with:

  • <codebase-context> root element
  • <meta> tag with token usage and budget
  • <content> section with indented context text
  • <sources> section with self-closing <source> elements

Examples:

adapter = ClaudeAdapter.new
xml = adapter.format(assembled_context)
# => "<codebase-context>\n  <meta tokens=\"42\" budget=\"8000\" />\n..."

Instance Method Summary collapse

Instance Method Details

#format(assembled_context) ⇒ String

Format assembled context as XML for Claude.

Parameters:

Returns:

  • (String)

    XML-formatted context



25
26
27
28
29
30
31
32
33
# File 'lib/woods/formatting/claude_adapter.rb', line 25

def format(assembled_context)
  parts = []
  parts << '<codebase-context>'
  parts << "  <meta tokens=\"#{assembled_context.tokens_used}\" budget=\"#{assembled_context.budget}\" />"
  parts << format_content(assembled_context.context)
  parts << format_sources(assembled_context.sources)
  parts << '</codebase-context>'
  parts.join("\n")
end