Skip to main content
Glama

faf_init

Initialize a project.faf configuration file to set up FAF context for project management, creating directories as needed.

Instructions

Create project.faf for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoForce reinitialize existing FAF context
directoryNoProject directory path (supports ~ tilde expansion). Creates directory if it doesn't exist.
pathNoAlias for directory parameter
projectNameNoProject name for path inference (used with Projects convention)

Implementation Reference

  • The `handleFafInit` method is the core logic that handles initializing a project, setting up the `project.faf` file, and applying "Intel-Friday" enhancements if a project is recognized as a Chrome extension.
      private async handleFafInit(args: any): Promise<CallToolResult> {
        // Native implementation - creates project.faf with Projects convention!
        try {
          // Determine project path using Projects convention or explicit path
          let targetDir: string;
          let projectName: string;
    
          // Accept both 'directory' (legacy) and 'path' (new)
          const explicitPath = args?.path || args?.directory;
    
          if (explicitPath) {
            // User explicit path always wins
            // Expand tilde (~) to home directory
            const expandedPath = explicitPath.startsWith('~')
              ? path.join(require('os').homedir(), explicitPath.slice(1))
              : explicitPath;
            targetDir = path.resolve(expandedPath);
            projectName = path.basename(targetDir);
    
            // Ensure directory exists
            if (!fs.existsSync(targetDir)) {
              fs.mkdirSync(targetDir, { recursive: true });
            }
          } else if (args?.projectName) {
            // Use Projects convention with provided name
            ensureProjectsDirectory();
            const resolution = resolveProjectPath(args.projectName);
            targetDir = resolution.projectPath;
            projectName = resolution.projectName;
    
            // Ensure project directory exists
            if (!fs.existsSync(targetDir)) {
              fs.mkdirSync(targetDir, { recursive: true });
            }
          } else {
            // Use current working directory (legacy behavior)
            targetDir = this.engineAdapter.getWorkingDirectory();
            projectName = path.basename(targetDir);
          }
    
          const fafPath = path.join(targetDir, 'project.faf');
    
          // Check if any FAF file exists and force flag
          const existingFaf = await findFafFile(targetDir);
          if (existingFaf && !args?.force) {
            return {
              content: [{
                type: 'text',
                text: `πŸš€ Claude FAF Initialization:\n\n⚠️ ${existingFaf.filename} already exists in ${targetDir}\nπŸ’‘ Use force: true to overwrite`
              }]
            };
          }
    
          // Check project type with fuzzy detection (Friday Feature!)
          const projectDescription = args?.description || '';
    
          // Detect Chrome Extension with fuzzy matching
          const chromeDetection = FuzzyDetector.detectChromeExtension(projectDescription);
          const projectType = FuzzyDetector.detectProjectType(projectDescription);
    
          // Build project data with Intel-Friday auto-fill!
          let projectData: any = {
            project: projectName,
            project_type: projectType,
            description: projectDescription,
            generated: new Date().toISOString(),
            version: VERSION
          };
    
          // Apply Intel-Friday: Auto-fill Chrome Extension slots for 90%+ score!
          if (chromeDetection.detected) {
            projectData = applyIntelFriday(projectData);
          }
    
          // Create enhanced .faf content
          const fafContent = `# USE>FAF - call FAF-MCP (or faf/cli)
    # FAF - Foundational AI Context
    project: ${projectData.project}
    type: ${projectData.project_type}${chromeDetection.detected ? ' 🎯' : ''}
    context: I⚑🍊
    generated: ${projectData.generated}
    version: ${projectData.version}
    ${chromeDetection.corrected ? `# Auto-corrected: "${args?.description}" β†’ "${chromeDetection.corrected}"` : ''}
    
    # The Formula
    human_input: Your project files
    multiplier: FAF Context
    output: Championship Performance
    
    # Quick Context
    working_directory: ${targetDir}
    initialized_by: claude-faf-mcp${projectData._friday_feature ? `\nfriday_feature: ${projectData._friday_feature}` : ''}
    vitamin_context: true
    faffless: true
    
    ${chromeDetection.detected ? `# Chrome Extension Auto-Fill (90%+ Score!)
    runtime: ${projectData.runtime}
    hosting: ${projectData.hosting}
    api_type: ${projectData.api_type}
    backend: ${projectData.backend}
    database: ${projectData.database}
    build: ${projectData.build}
    package_manager: ${projectData.package_manager}` : ''}
    `;
    
          fs.writeFileSync(fafPath, fafContent);
    
          return {
            content: [{
              type: 'text',
              text: `πŸš€ Claude FAF Initialization:\n\nβœ… Created project.faf in ${targetDir}\n🍊 Vitamin Context activated!\n⚑ FAFFLESS AI ready!${
                chromeDetection.detected ? '\n\n🎯 Friday Feature: Chrome Extension detected!\nπŸ“ˆ Auto-filled 7 slots for 90%+ score!' : ''
              }${
                chromeDetection.corrected ? `\nπŸ“ Auto-corrected: "${args?.description}" β†’ "${chromeDetection.corrected}"` : ''
              }`
            }]
          };
        } catch (error: any) {
          return {
            content: [{

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Wolfe-Jam/grok-faf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server