                 parseInt(process.env.HUBOT_SHELL_HISTSIZE)
               else
                 1024
+
+historyPath = ".hubot_history"
 
 class Shell extends Adapter
   send: (envelope, strings...) ->

        startIndex = history.length - historySize
        history = history.reverse().splice(startIndex, historySize)

        outstream = fs.createWriteStream('.hubot_history')
        # >= node 0.10
        outstream.on 'finish', () =>
          @shutdown()


    @cli.on 'history', (item) =>
      if item.length > 0 and item isnt 'exit' and item isnt 'history'
        fs.appendFile historyPath, "#{item}\n", (err) =>
          @robot.emit 'error', err if err

    @cli.on 'close', () =>
