agent

package
v0.6.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ApprovalThreshold = 70

ApprovalThreshold is the minimum score required for approval

Variables

This section is empty.

Functions

func SaveConfig

func SaveConfig(config *PipelineConfig, path string) error

SaveConfig saves pipeline configuration to a JSON file

Types

type AgentConfig

type AgentConfig struct {
	Type        AgentType `json:"type"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	PromptFile  string    `json:"prompt_file"` // Path to prompt template file
	Enabled     bool      `json:"enabled"`
	Model       string    `json:"model,omitempty"` // Optional model override (e.g., "sonnet", "opus")
}

AgentConfig holds configuration for a single agent

type AgentType

type AgentType string

AgentType identifies the type of agent in the pipeline

const (
	AgentParser   AgentType = "parser"
	AgentResume   AgentType = "resume"
	AgentCover    AgentType = "cover"
	AgentReviewer AgentType = "reviewer"
	AgentTracker  AgentType = "tracker"
)

type CVBasics

type CVBasics struct {
	Name     string      `json:"name"`
	Label    string      `json:"label"`
	Email    string      `json:"email"`
	Phone    string      `json:"phone"`
	URL      string      `json:"url"`
	Summary  string      `json:"summary"`
	Location CVLocation  `json:"location"`
	Profiles []CVProfile `json:"profiles"`
}

CVBasics holds basic contact information

type CVData

type CVData struct {
	Basics    CVBasics      `json:"basics"`
	Work      []CVWork      `json:"work"`
	Education []CVEducation `json:"education"`
	Skills    []CVSkill     `json:"skills"`
	Languages []CVLanguage  `json:"languages,omitempty"`
	Projects  []CVProject   `json:"projects,omitempty"`
}

CVData represents the candidate's CV in JSON Resume format

type CVEducation

type CVEducation struct {
	Institution string   `json:"institution"`
	URL         string   `json:"url"`
	Area        string   `json:"area"`
	StudyType   string   `json:"studyType"`
	StartDate   string   `json:"startDate"`
	EndDate     string   `json:"endDate"`
	Score       string   `json:"score,omitempty"`
	Courses     []string `json:"courses,omitempty"`
}

CVEducation represents an education entry

type CVLanguage

type CVLanguage struct {
	Language string `json:"language"`
	Fluency  string `json:"fluency"`
}

CVLanguage represents a spoken language

type CVLocation

type CVLocation struct {
	City        string `json:"city"`
	Region      string `json:"region"`
	CountryCode string `json:"countryCode"`
}

CVLocation represents address information

type CVProfile

type CVProfile struct {
	Network  string `json:"network"`
	Username string `json:"username"`
	URL      string `json:"url"`
}

CVProfile represents a social/professional profile

type CVProject

type CVProject struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Highlights  []string `json:"highlights"`
	Keywords    []string `json:"keywords"`
	StartDate   string   `json:"startDate"`
	EndDate     string   `json:"endDate,omitempty"`
	URL         string   `json:"url,omitempty"`
}

CVProject represents a project entry

type CVSkill

type CVSkill struct {
	Name     string   `json:"name"`
	Level    string   `json:"level,omitempty"`
	Keywords []string `json:"keywords"`
}

CVSkill represents a skill category

type CVWork

type CVWork struct {
	Name       string   `json:"name"`
	Position   string   `json:"position"`
	URL        string   `json:"url"`
	StartDate  string   `json:"startDate"`
	EndDate    string   `json:"endDate,omitempty"`
	Summary    string   `json:"summary"`
	Highlights []string `json:"highlights"`
	Location   string   `json:"location,omitempty"`
}

CVWork represents a work experience entry

type CoverLetterGeneratorAgent

type CoverLetterGeneratorAgent struct {
	Config  *AgentConfig
	BaseDir string
}

CoverLetterGeneratorAgent generates tailored cover letters based on job postings and CV data

func NewCoverLetterGeneratorAgent

func NewCoverLetterGeneratorAgent(config *AgentConfig, baseDir string) *CoverLetterGeneratorAgent

NewCoverLetterGeneratorAgent creates a new cover letter generator agent instance

func (*CoverLetterGeneratorAgent) CompilePDF

func (c *CoverLetterGeneratorAgent) CompilePDF(typstPath string) (string, error)

CompilePDF compiles the Typst file to PDF using the typst CLI

func (*CoverLetterGeneratorAgent) ExtractRelevantExperiences

func (c *CoverLetterGeneratorAgent) ExtractRelevantExperiences(cv *CVData, posting *ParsedPosting, limit int) []CVWork

ExtractRelevantExperiences finds the most relevant work experiences for the job

func (*CoverLetterGeneratorAgent) Generate

func (c *CoverLetterGeneratorAgent) Generate(posting *ParsedPosting, cvPath, resumePath, outputDir, jobType string) (*CoverLetterOutput, error)

Generate runs the full cover letter generation flow

func (*CoverLetterGeneratorAgent) GenerateOutputPath

func (c *CoverLetterGeneratorAgent) GenerateOutputPath(posting *ParsedPosting, jobType, outputDir string) string

GenerateOutputPath creates the output file path for the cover letter

func (*CoverLetterGeneratorAgent) GetSystemPrompt

func (c *CoverLetterGeneratorAgent) GetSystemPrompt() string

GetSystemPrompt returns the system prompt for cover letter generation

func (*CoverLetterGeneratorAgent) GetUserPrompt

func (c *CoverLetterGeneratorAgent) GetUserPrompt(posting *ParsedPosting, cv *CVData, resumeContent string) (string, error)

GetUserPrompt creates the user prompt with job posting, CV, and resume context

func (*CoverLetterGeneratorAgent) IsTypstAvailable

func (c *CoverLetterGeneratorAgent) IsTypstAvailable() bool

IsTypstAvailable checks if the typst CLI is installed

func (*CoverLetterGeneratorAgent) LoadCV

func (c *CoverLetterGeneratorAgent) LoadCV(cvPath string) (*CVData, error)

LoadCV loads the candidate CV from the specified path

func (*CoverLetterGeneratorAgent) LoadResume

func (c *CoverLetterGeneratorAgent) LoadResume(resumePath string) (string, error)

LoadResume reads the generated resume for consistency reference

func (*CoverLetterGeneratorAgent) LoadTemplate

func (c *CoverLetterGeneratorAgent) LoadTemplate(templatePath string) (string, error)

LoadTemplate reads the base cover letter Typst template

func (*CoverLetterGeneratorAgent) ParseTypstOutput

func (c *CoverLetterGeneratorAgent) ParseTypstOutput(output string) (string, error)

ParseTypstOutput validates and cleans the AI-generated Typst content

func (*CoverLetterGeneratorAgent) WriteTypst

func (c *CoverLetterGeneratorAgent) WriteTypst(content, outputPath string) error

WriteTypst writes the generated Typst content to a file

type CoverLetterOutput

type CoverLetterOutput struct {
	TypstPath string `json:"typst_path"`
	PDFPath   string `json:"pdf_path,omitempty"`
	Company   string `json:"company"`
	Position  string `json:"position"`
}

CoverLetterOutput represents the generated cover letter paths

type DetailedReviewResult

type DetailedReviewResult struct {
	Approved       bool           `json:"approved"`
	OverallScore   int            `json:"overall_score"`
	ResumeReview   DocumentReview `json:"resume_review"`
	CoverReview    DocumentReview `json:"cover_letter_review"`
	MatchAnalysis  MatchAnalysis  `json:"match_analysis"`
	Recommendation string         `json:"recommendation"`
}

DetailedReviewResult holds comprehensive review feedback

type DocumentReview

type DocumentReview struct {
	Score       int      `json:"score"`
	Strengths   []string `json:"strengths"`
	Weaknesses  []string `json:"weaknesses"`
	Suggestions []string `json:"suggestions"`
}

DocumentReview holds the review for a single document

type GeneratedDocuments

type GeneratedDocuments struct {
	ResumePath      string `json:"resume_path,omitempty"`
	CoverLetterPath string `json:"cover_letter_path,omitempty"`
	ResumePDF       string `json:"resume_pdf,omitempty"`
	CoverLetterPDF  string `json:"cover_letter_pdf,omitempty"`
}

GeneratedDocuments holds paths to generated resume and cover letter

type MatchAnalysis

type MatchAnalysis struct {
	RequirementsMet     []string `json:"requirements_met"`
	RequirementsMissing []string `json:"requirements_missing"`
	BonusPointsHit      []string `json:"bonus_points_hit"`
}

MatchAnalysis analyzes how well the candidate matches the job requirements

type OutputConfig

type OutputConfig struct {
	GeneratePDF bool   `json:"generate_pdf"`
	PDFEngine   string `json:"pdf_engine"` // "typst" or "pandoc"
	KeepTypst   bool   `json:"keep_typst"` // Keep .typ source files
	Naming      string `json:"naming"`     // Output file naming pattern
}

OutputConfig defines output generation settings

type ParsedPosting

type ParsedPosting struct {
	Company       string   `json:"company"`
	Position      string   `json:"position"`
	Team          string   `json:"team,omitempty"`
	Location      string   `json:"location,omitempty"`
	Remote        bool     `json:"remote,omitempty"`
	SalaryMin     int      `json:"salary_min,omitempty"`
	SalaryMax     int      `json:"salary_max,omitempty"`
	JobURL        string   `json:"job_url,omitempty"`
	Requirements  []string `json:"requirements,omitempty"`
	BonusSkills   []string `json:"bonus_skills,omitempty"`
	Keywords      []string `json:"keywords,omitempty"`
	TechStack     []string `json:"tech_stack,omitempty"`
	CompanyValues []string `json:"company_values,omitempty"`
	Description   string   `json:"description,omitempty"`
	Notes         string   `json:"notes,omitempty"`
}

ParsedPosting represents structured data extracted from a job posting

type ParserAgent

type ParserAgent struct {
	Config *AgentConfig
}

ParserAgent extracts structured data from job posting files

func NewParserAgent

func NewParserAgent(config *AgentConfig) *ParserAgent

NewParserAgent creates a new parser agent instance

func (*ParserAgent) GetOutputSchema

func (p *ParserAgent) GetOutputSchema() string

GetOutputSchema returns the JSON schema for the parser output

func (*ParserAgent) GetSystemPrompt

func (p *ParserAgent) GetSystemPrompt() string

GetSystemPrompt returns the system prompt for the parser agent

func (*ParserAgent) GetUserPrompt

func (p *ParserAgent) GetUserPrompt(content string, filePath string) string

GetUserPrompt creates the user prompt with the job posting content

func (*ParserAgent) IsImageFile

func (p *ParserAgent) IsImageFile(path string) bool

IsImageFile checks if the given file is an image

func (*ParserAgent) IsSupported

func (p *ParserAgent) IsSupported(path string) bool

IsSupported checks if the given file extension is supported

func (*ParserAgent) ParseJSON

func (p *ParserAgent) ParseJSON(jsonStr string) (*ParsedPosting, error)

ParseJSON parses JSON output from the AI into a ParsedPosting struct

func (*ParserAgent) ReadPosting

func (p *ParserAgent) ReadPosting(path string) (string, error)

ReadPosting reads the content of a job posting file

func (*ParserAgent) SupportedExtensions

func (p *ParserAgent) SupportedExtensions() []string

SupportedExtensions returns file extensions the parser can handle

func (*ParserAgent) ValidateParsedPosting

func (p *ParserAgent) ValidateParsedPosting(parsed *ParsedPosting) error

ValidateParsedPosting validates the parsed posting has required fields

type PathsConfig

type PathsConfig struct {
	PostingsDir     string `json:"postings_dir"`
	ResumesDir      string `json:"resumes_dir"`
	CoverLettersDir string `json:"cover_letters_dir"`
	TemplatesDir    string `json:"templates_dir"`
	OutputDir       string `json:"output_dir"`
}

PathsConfig defines paths used by the pipeline

type Pipeline

type Pipeline struct {
	Config    *PipelineConfig
	Store     *store.Store
	State     *PipelineState
	BaseDir   string
	StateFile string
}

Pipeline orchestrates the multi-agent document generation workflow

func NewPipeline

func NewPipeline(configPath string, store *store.Store) (*Pipeline, error)

NewPipeline creates a new pipeline instance

func (*Pipeline) GetStatus

func (p *Pipeline) GetStatus() string

GetStatus returns a summary of the pipeline status

func (*Pipeline) LoadState

func (p *Pipeline) LoadState() error

LoadState loads pipeline state from disk

func (*Pipeline) Resume

func (p *Pipeline) Resume() error

Resume continues a paused or failed pipeline from the current step

func (*Pipeline) Run

func (p *Pipeline) Run(postingPath string) error

Run executes the full pipeline for a job posting

type PipelineConfig

type PipelineConfig struct {
	Version string `json:"version"`

	// Paths configuration
	Paths PathsConfig `json:"paths"`

	// Agent configurations
	Agents []AgentConfig `json:"agents"`

	// Output settings
	Output OutputConfig `json:"output"`
}

PipelineConfig holds the full pipeline configuration

func DefaultConfig

func DefaultConfig() *PipelineConfig

DefaultConfig returns a default pipeline configuration

func LoadConfig

func LoadConfig(path string) (*PipelineConfig, error)

LoadConfig loads pipeline configuration from a JSON file

func (*PipelineConfig) EnabledAgents

func (c *PipelineConfig) EnabledAgents() []AgentConfig

EnabledAgents returns a list of enabled agents in pipeline order

func (*PipelineConfig) GetAgentConfig

func (c *PipelineConfig) GetAgentConfig(agentType AgentType) *AgentConfig

GetAgentConfig returns the configuration for a specific agent type

type PipelineState

type PipelineState struct {
	PostingPath string                   `json:"posting_path"`
	StartedAt   string                   `json:"started_at"`
	Status      string                   `json:"status"` // "running", "completed", "failed", "paused"
	CurrentStep AgentType                `json:"current_step"`
	Results     map[AgentType]StepResult `json:"results"`
}

PipelineState tracks the state of a pipeline run

type RejectionFeedback

type RejectionFeedback struct {
	Posting        *ParsedPosting `json:"posting"`
	OverallScore   int            `json:"overall_score"`
	Issues         []string       `json:"issues"`
	Suggestions    []string       `json:"suggestions"`
	Recommendation string         `json:"recommendation"`
}

RejectionFeedback holds feedback when documents are rejected

type ResumeGeneratorAgent

type ResumeGeneratorAgent struct {
	Config  *AgentConfig
	BaseDir string
}

ResumeGeneratorAgent generates tailored resumes based on job postings and CV data

func NewResumeGeneratorAgent

func NewResumeGeneratorAgent(config *AgentConfig, baseDir string) *ResumeGeneratorAgent

NewResumeGeneratorAgent creates a new resume generator agent instance

func (*ResumeGeneratorAgent) CompilePDF

func (r *ResumeGeneratorAgent) CompilePDF(typstPath string) (string, error)

CompilePDF compiles the Typst file to PDF using the typst CLI

func (*ResumeGeneratorAgent) ExtractMatchingSkills

func (r *ResumeGeneratorAgent) ExtractMatchingSkills(cv *CVData, posting *ParsedPosting) []string

ExtractMatchingSkills finds skills from CV that match job requirements

func (*ResumeGeneratorAgent) Generate

func (r *ResumeGeneratorAgent) Generate(posting *ParsedPosting, cvPath, templatePath, outputDir, jobType string) (*ResumeOutput, error)

Generate runs the full resume generation flow

func (*ResumeGeneratorAgent) GenerateOutputPath

func (r *ResumeGeneratorAgent) GenerateOutputPath(posting *ParsedPosting, jobType, outputDir string) string

GenerateOutputPath creates the output file path for the resume

func (*ResumeGeneratorAgent) GetSystemPrompt

func (r *ResumeGeneratorAgent) GetSystemPrompt() string

GetSystemPrompt returns the system prompt for resume generation

func (*ResumeGeneratorAgent) GetUserPrompt

func (r *ResumeGeneratorAgent) GetUserPrompt(posting *ParsedPosting, cv *CVData, template string) (string, error)

GetUserPrompt creates the user prompt with job posting, CV, and template

func (*ResumeGeneratorAgent) IsTypstAvailable

func (r *ResumeGeneratorAgent) IsTypstAvailable() bool

IsTypstAvailable checks if the typst CLI is installed

func (*ResumeGeneratorAgent) LoadCV

func (r *ResumeGeneratorAgent) LoadCV(cvPath string) (*CVData, error)

LoadCV loads the candidate CV from the specified path

func (*ResumeGeneratorAgent) LoadTemplate

func (r *ResumeGeneratorAgent) LoadTemplate(templatePath string) (string, error)

LoadTemplate reads the base resume Typst template

func (*ResumeGeneratorAgent) ParseTypstOutput

func (r *ResumeGeneratorAgent) ParseTypstOutput(output string) (string, error)

ParseTypstOutput validates and cleans the AI-generated Typst content

func (*ResumeGeneratorAgent) ValidateCV

func (r *ResumeGeneratorAgent) ValidateCV(cv *CVData) error

ValidateCV checks that the CV has required fields

func (*ResumeGeneratorAgent) WriteTypst

func (r *ResumeGeneratorAgent) WriteTypst(content, outputPath string) error

WriteTypst writes the generated Typst content to a file

type ResumeOutput

type ResumeOutput struct {
	TypstPath string `json:"typst_path"`
	PDFPath   string `json:"pdf_path,omitempty"`
	Company   string `json:"company"`
	Position  string `json:"position"`
}

ResumeOutput represents the generated resume paths

type ReviewResult

type ReviewResult struct {
	Approved bool     `json:"approved"`
	Score    int      `json:"score,omitempty"`    // 1-10 rating
	Feedback []string `json:"feedback,omitempty"` // List of suggestions
	Issues   []string `json:"issues,omitempty"`   // Critical issues to fix
}

ReviewResult holds the reviewer agent's feedback

type ReviewerAgent

type ReviewerAgent struct {
	Config  *AgentConfig
	BaseDir string
}

ReviewerAgent reviews generated documents from a hiring manager perspective

func NewReviewerAgent

func NewReviewerAgent(config *AgentConfig, baseDir string) *ReviewerAgent

NewReviewerAgent creates a new reviewer agent instance

func (*ReviewerAgent) AnalyzeRequirementMatch

func (r *ReviewerAgent) AnalyzeRequirementMatch(cv *CVData, posting *ParsedPosting) *MatchAnalysis

AnalyzeRequirementMatch checks which requirements from posting are met by CV

func (*ReviewerAgent) CalculateOverallScore

func (r *ReviewerAgent) CalculateOverallScore(resumeScore, coverLetterScore int) int

CalculateOverallScore computes weighted average of component scores

func (*ReviewerAgent) ConvertToSimpleReview

func (r *ReviewerAgent) ConvertToSimpleReview(detailed *DetailedReviewResult) *ReviewResult

ConvertToSimpleReview converts DetailedReviewResult to the simpler ReviewResult

func (*ReviewerAgent) DetermineRecommendation

func (r *ReviewerAgent) DetermineRecommendation(score int) string

DetermineRecommendation returns recommendation based on score

func (*ReviewerAgent) GetSystemPrompt

func (r *ReviewerAgent) GetSystemPrompt() string

GetSystemPrompt returns the system prompt for the reviewer agent

func (*ReviewerAgent) GetUserPrompt

func (r *ReviewerAgent) GetUserPrompt(posting *ParsedPosting, resumeContent, coverLetterContent string, cv *CVData) (string, error)

GetUserPrompt creates the user prompt with documents and posting data

func (*ReviewerAgent) IsApproved

func (r *ReviewerAgent) IsApproved(score int) bool

IsApproved checks if the score meets the approval threshold

func (*ReviewerAgent) LoadDocument

func (r *ReviewerAgent) LoadDocument(path string) (string, error)

LoadDocument reads a document file (resume or cover letter)

func (*ReviewerAgent) ParseReviewOutput

func (r *ReviewerAgent) ParseReviewOutput(output string) (*DetailedReviewResult, error)

ParseReviewOutput parses and validates AI-generated review JSON

func (*ReviewerAgent) Review

func (r *ReviewerAgent) Review(posting *ParsedPosting, resumePath, coverLetterPath, cvPath string) (*DetailedReviewResult, error)

Review runs the full document review flow

type StepResult

type StepResult struct {
	Status   string          `json:"status"` // "pending", "running", "completed", "failed", "skipped"
	Input    json.RawMessage `json:"input,omitempty"`
	Output   json.RawMessage `json:"output,omitempty"`
	Error    string          `json:"error,omitempty"`
	Duration string          `json:"duration,omitempty"`
}

StepResult holds the output of a single pipeline step

type TrackerAgent

type TrackerAgent struct {
	Config  *AgentConfig
	Store   *store.Store
	BaseDir string
}

TrackerAgent integrates pipeline results with the ghosted tracker

func NewTrackerAgent

func NewTrackerAgent(config *AgentConfig, appStore *store.Store, baseDir string) *TrackerAgent

NewTrackerAgent creates a new tracker agent instance

func (*TrackerAgent) ArchivePosting

func (t *TrackerAgent) ArchivePosting(postingPath, processedDir string) error

ArchivePosting moves the original posting to the processed folder

func (*TrackerAgent) CopyPostingToApplicationFolder

func (t *TrackerAgent) CopyPostingToApplicationFolder(postingPath, applicationDir string) error

CopyPostingToApplicationFolder copies the original posting to the application folder

func (*TrackerAgent) CreateApplication

func (t *TrackerAgent) CreateApplication(input *TrackerInput) (*model.Application, error)

CreateApplication creates a new application entry in the store

func (*TrackerAgent) DetermineJobType

func (t *TrackerAgent) DetermineJobType(posting *ParsedPosting) string

DetermineJobType infers the job type from posting data

func (*TrackerAgent) FormatDocumentPath

func (t *TrackerAgent) FormatDocumentPath(fullPath, applicationFolder string) string

FormatDocumentPath creates a relative path for storage in the tracker

func (*TrackerAgent) GenerateApplicationFolder

func (t *TrackerAgent) GenerateApplicationFolder(posting *ParsedPosting, jobType string) string

GenerateApplicationFolder creates the folder name for an application

func (*TrackerAgent) GenerateNotes

func (t *TrackerAgent) GenerateNotes(input *TrackerInput) string

GenerateNotes creates notes from the parsed posting and review

func (*TrackerAgent) GetSystemPrompt

func (t *TrackerAgent) GetSystemPrompt() string

GetSystemPrompt returns the system prompt for tracker integration

func (*TrackerAgent) GetUserPrompt

func (t *TrackerAgent) GetUserPrompt(input *TrackerInput) (string, error)

GetUserPrompt creates the user prompt with pipeline data

func (*TrackerAgent) Integrate

func (t *TrackerAgent) Integrate(input *TrackerInput) (*TrackerOutput, error)

Integrate runs the full tracker integration flow

func (*TrackerAgent) SaveRejectionFeedback

func (t *TrackerAgent) SaveRejectionFeedback(input *TrackerInput, outputDir string) (string, error)

SaveRejectionFeedback saves feedback when documents are rejected

func (*TrackerAgent) ValidateInput

func (t *TrackerAgent) ValidateInput(input *TrackerInput) error

ValidateInput checks that required fields are present

type TrackerInput

type TrackerInput struct {
	Posting           *ParsedPosting        `json:"posting"`
	Documents         *GeneratedDocuments   `json:"documents"`
	ReviewResult      *ReviewResult         `json:"review_result,omitempty"`
	DetailedReview    *DetailedReviewResult `json:"detailed_review,omitempty"`
	ApplicationFolder string                `json:"application_folder"`
	JobType           string                `json:"job_type"`
}

TrackerInput holds the data needed to create a tracker entry

type TrackerOutput

type TrackerOutput struct {
	ApplicationID   string `json:"application_id"`
	Status          string `json:"status"`
	ResumeVersion   string `json:"resume_version"`
	CoverLetter     string `json:"cover_letter"`
	PostingArchived bool   `json:"posting_archived"`
	Notes           string `json:"notes"`
}

TrackerOutput holds the result of tracker integration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL